summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-grid.tex
blob: 7440e24474b324198331aee0e21817c1fff3532a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
\section{Use of \tkzcname{tkzGrid}} \hypertarget{grid}{}   

\begin{NewMacroBox}{tkzGrid}{\oarg{local options}\parg{$x_A~;~y_A$} \parg{$x_B~;~y_B$}}%
A few changes for this macro. First of all, to simplify currently the color of the thinnest grid is determined automatically from the main grid, same process for the thickness.  This behavior can be modified using styles. 

\begin{tabular}{lll}%
options   & default & definition                                        \\
\midrule  
\TAline{\parg{$x_A~;~y_A$} \parg{$x_B~;~y_B$}}{(xmin,ymin)(xmax,ymax)} {grid pattern} 
\end{tabular}  
 
\begin{tabular}{lll}%
options   & default & definition                                        \\
\midrule  
\TOline{sub}{true} {asks for a sub-grid }
\TOline{color}{darkgray}{main grid color}
\TOline{subxstep}{0.2} {the step of the subgraduations for the abscissa axis}  
\TOline{subystep}{0.2}{the step of the subgraduations for the ordinate axis } 
\TOline{line width}{0.4pt} {main grid line thickness} 
\bottomrule  
\end{tabular}

\medskip
Default values can be changed in the configuration file or by macros. The color of the second grid is the same as the main grid, but less intense (by default |gray!50|). Same behavior for the line thickness (by default |0.75 of line width|). See the examples to change this behavior.
\end{NewMacroBox}  

\subsubsection{\tkzcname{tkzGrid} and the option \tkzname{sub}}
The option \tkzname{sub} allows you to display a finer secondary grid.
It is preferable to run \tkzcname{tkzGrid} first,
 to prevent the grid from being overlapped with other elements.
\begin{tkzexample}[latex=8cm,small]
\begin{tikzpicture}
 \tkzInit[xmax=4, ymax=2]
 \tkzGrid[sub] 
 \tkzAxeXY    
\end{tikzpicture}
\end{tkzexample}  

\subsubsection{Option \tkzname{sub}}
The option \tkzname{sub} allows to display a finer secondary grid. Some parameters are modifiable.

\begin{tkzexample}[latex=6cm,small] 
\def\tkzCoeffSubColor{20}% instead of 50
\def\tkzCoeffSubLw{0.2}% instead of 0.75 
\begin{tikzpicture}
 \tkzInit[xmax=4, ymax=2]
 % we can change the step for the second grid 
 \tkzGrid[sub,color=orange,
         subxstep=.5,subystep=.5] 
  \tkzAxeXY 
\end{tikzpicture}
\end{tkzexample}    

\subsubsection{Almost Default}
\begin{tkzexample}[width=7cm,small]
\begin{tikzpicture}
  \tkzInit[xmax=5,ymax=2]
  \tkzGrid[color=orange]
  \tkzAxeXY  
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Under the grid, too, option \tkzname{sub}}
\begin{tkzexample}[width=7cm,small]
 \begin{tikzpicture}
  \tkzInit[xmax=5,ymax=2]
  \tkzGrid[sub,color=orange]
  \tkzGrid[color=orange]
  \tkzAxeXY  
 \end{tikzpicture}
\end{tkzexample}

\subsubsection{Grid change}
\begin{tkzexample}[width=7cm,small]
\begin{tikzpicture}
  \tkzInit[xmax=5,ymax=2]
  \tkzGrid[color    = orange,
           sub,
           subxstep = 0.1,
           subystep = 0.1] 
   \tkzAxeXY 
\end{tikzpicture}
\end{tkzexample}
 
\subsubsection{Option \tkzname{xstep}, \tkzname{xstep}, \tkzname{subxstep} and \tkzname{subystep}}
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}
\tkzInit[xmax=.5,xstep=.1,
         ymax=.2,ystep=.1]
\tkzGrid[sub,
         subxstep = 0.05,
         subystep = 0.05,
         color=orange]
\tkzAxeXY 
\end{tikzpicture} 
\end{tkzexample}

\subsubsection{With large intervals}
\begin{tkzexample}[width=7cm,small]
\begin{tikzpicture}
   \tkzInit[xmax=100,xstep=20,
            ymax=3000,ystep=1000]
   \tkzGrid[sub,subxstep=10,
                subystep=500,
                color=orange]
   \tkzAxeXY 
\end{tikzpicture}
\end{tkzexample}

\subsubsection{\tkzcname{tkzGrid} and the arguments}  
The grid can be any size.
\begin{tkzexample}[width=8cm,small]
\begin{tikzpicture}
   \tkzInit[xmax=100,xstep=20,
            ymax=3000,ystep=1000]
   \tkzGrid[sub,subxstep=10,
            subystep=500,
            color=orange]
            (-20,-1000)(115,4000)%
  \tkzAxeXY 
\end{tikzpicture}
\end{tkzexample} 

\subsubsection{Use of \tkzname{pi} with \tkzcname{tkzGrid}} 
\begin{tkzexample}[width=8cm,small]   
\begin{tikzpicture}[scale=.75] 
   \tkzInit[xmax=6.5,ymax=6.5]
   \tkzGrid[xstep=pi,ystep=pi/2,sub,
            subxstep=pi/4,subystep=pi/4]
   \tkzLabelX[label=$t$,orig=false,trig=4,
            below=6pt,font=\scriptsize]
   \tkzLabelY[trig=2,font=\scriptsize]
   \tkzDrawXY  
\end{tikzpicture}  
\end{tkzexample}  

\subsubsection{Options \tkzname{frac} and \tkzname{trig} with \tkzcname{tkzGrid}}
\begin{tkzexample}[width=8cm,small]   
\begin{tikzpicture} 
   \tkzInit[xmax=9,xstep=3,ymax=4]
   \tkzGrid[xstep=1,ystep=pi/2,sub,
            subxstep=1,subystep=pi/4]
   \tkzLabelX[label=$t$,orig=false,frac=3,
            below=6pt,font=\scriptsize]
   \tkzLabelY[trig=2,font=\scriptsize]
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Use of a repetition grid}
\begin{tkzexample}[latex=8cm,small] 
\begin{tikzpicture}[scale=.5]
  \tikzset{xaxe style/.style ={-}} 
  \tkzInit[xmax=15,ymax=15]
  \tkzClip 
  \tkzGrid[sub,color=orange] 
  \tkzLabelX[label= ]   \tkzLabelY[label= ]
  \tkzDrawXY   
  \node[opacity=.5] at (8,6){%
    \includegraphics[scale=.5]{tiger}};
\end{tikzpicture}
\end{tkzexample}

                
\endinput