Debian Codegraph @

texmf-dist/doc/latex/tkz-base/TKZdoc-base-grid.tex

raw
1 \section{Use of \tkzcname{tkzGrid}} \hypertarget{grid}{}
2
3 \begin{NewMacroBox}{tkzGrid}{\oarg{local options}\parg{$x_A~;~y_A$} \parg{$x_B~;~y_B$}}%
4 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.
5
6 \begin{tabular}{lll}%
7 options & default & definition \\
8 \midrule
9 \TAline{\parg{$x_A~;~y_A$} \parg{$x_B~;~y_B$}}{(xmin,ymin)(xmax,ymax)} {grid pattern}
10 \end{tabular}
11
12 \begin{tabular}{lll}%
13 options & default & definition \\
14 \midrule
15 \TOline{sub}{true} {asks for a sub-grid }
16 \TOline{color}{darkgray}{main grid color}
17 \TOline{subxstep}{0.2} {the step of the subgraduations for the abscissa axis}
18 \TOline{subystep}{0.2}{the step of the subgraduations for the ordinate axis }
19 \TOline{line width}{0.4pt} {main grid line thickness}
20 \bottomrule
21 \end{tabular}
22
23 \medskip
24 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|).
25
26 Same behavior for the line thickness (by default |0.75 of line width|). See the examples to change this behavior.
27 \end{NewMacroBox}
28
29 \subsubsection{\tkzcname{tkzGrid} and the option \tkzname{sub}}
30 The option \tkzname{sub} allows you to display a finer secondary grid.
31 It is preferable to run \tkzcname{tkzGrid} first,
32 to prevent the grid from being overlapped with other elements.
33 \begin{tkzexample}[latex=8cm,small]
34 \begin{tikzpicture}
35 \tkzInit[xmax=4, ymax=2]
36 \tkzGrid[sub]
37 \tkzAxeXY
38 \end{tikzpicture}
39 \end{tkzexample}
40
41 \subsubsection{Option \tkzname{sub}}
42 The option \tkzname{sub} allows to display a finer secondary grid. Some parameters are modifiable.
43
44 \begin{tkzexample}[latex=6cm,small]
45 \def\tkzCoeffSubColor{20}% instead of 50
46 \def\tkzCoeffSubLw{0.2}% instead of 0.75
47 \begin{tikzpicture}
48 \tkzInit[xmax=4, ymax=2]
49 % we can change the step for the second grid
50 \tkzGrid[sub,color=orange,
51 subxstep=.5,subystep=.5]
52 \tkzAxeXY
53 \end{tikzpicture}
54 \end{tkzexample}
55
56 \subsubsection{Almost Default}
57 \begin{tkzexample}[width=7cm,small]
58 \begin{tikzpicture}
59 \tkzInit[xmax=5,ymax=2]
60 \tkzGrid[color=orange]
61 \tkzAxeXY
62 \end{tikzpicture}
63 \end{tkzexample}
64
65 \subsubsection{Under the grid, too, option \tkzname{sub}}
66 \begin{tkzexample}[width=7cm,small]
67 \begin{tikzpicture}
68 \tkzInit[xmax=5,ymax=2]
69 \tkzGrid[sub,color=orange]
70 \tkzGrid[color=orange]
71 \tkzAxeXY
72 \end{tikzpicture}
73 \end{tkzexample}
74
75 \subsubsection{Grid change}
76 \begin{tkzexample}[width=7cm,small]
77 \begin{tikzpicture}
78 \tkzInit[xmax=5,ymax=2]
79 \tkzGrid[color = orange,
80 sub,
81 subxstep = 0.1,
82 subystep = 0.1]
83 \tkzAxeXY
84 \end{tikzpicture}
85 \end{tkzexample}
86
87 \subsubsection{Option \tkzname{xstep}, \tkzname{xstep}, \tkzname{subxstep} and \tkzname{subystep}}
88 \begin{tkzexample}[latex=7cm,small]
89 \begin{tikzpicture}
90 \tkzInit[xmax=.5,xstep=.1,
91 ymax=.2,ystep=.1]
92 \tkzGrid[sub,
93 subxstep = 0.05,
94 subystep = 0.05,
95 color=orange]
96 \tkzAxeXY
97 \end{tikzpicture}
98 \end{tkzexample}
99
100 \subsubsection{With large intervals}
101 \begin{tkzexample}[width=7cm,small]
102 \begin{tikzpicture}
103 \tkzInit[xmax=100,xstep=20,
104 ymax=3000,ystep=1000]
105 \tkzGrid[sub,subxstep=10,
106 subystep=500,
107 color=orange]
108 \tkzAxeXY
109 \end{tikzpicture}
110 \end{tkzexample}
111
112 \subsubsection{\tkzcname{tkzGrid} and the arguments}
113 The grid can be any size.
114 \begin{tkzexample}[width=8cm,small]
115 \begin{tikzpicture}
116 \tkzInit[xmax=100,xstep=20,
117 ymax=3000,ystep=1000]
118 \tkzGrid[sub,subxstep=10,
119 subystep=500,
120 color=orange]
121 (-20,-1000)(115,4000)%
122 \tkzAxeXY
123 \end{tikzpicture}
124 \end{tkzexample}
125
126 \subsubsection{Use of \tkzname{pi} with \tkzcname{tkzGrid}}
127 \begin{tkzexample}[width=8cm,small]
128 \begin{tikzpicture}[scale=.75]
129 \tkzInit[xmax=6.5,ymax=6.5]
130 \tkzGrid[xstep=pi,ystep=pi/2,sub,
131 subxstep=pi/4,subystep=pi/4]
132 \tkzLabelX[label=$t$,orig=false,trig=4,
133 below=6pt,font=\scriptsize]
134 \tkzLabelY[trig=2,font=\scriptsize]
135 \tkzDrawXY
136 \end{tikzpicture}
137 \end{tkzexample}
138
139 \subsubsection{Options \tkzname{frac} and \tkzname{trig} with \tkzcname{tkzGrid}}
140 \begin{tkzexample}[width=8cm,small]
141 \begin{tikzpicture}
142 \tkzInit[xmax=9,xstep=3,ymax=4]
143 \tkzGrid[xstep=1,ystep=pi/2,sub,
144 subxstep=1,subystep=pi/4]
145 \tkzLabelX[label=$t$,orig=false,frac=3,
146 below=6pt,font=\scriptsize]
147 \tkzLabelY[trig=2,font=\scriptsize]
148 \end{tikzpicture}
149 \end{tkzexample}
150
151 \subsubsection{Use of a repetition grid}
152 \begin{tkzexample}[latex=8cm,small]
153 \begin{tikzpicture}[scale=.5]
154 % \tikzset{xaxe style/.style ={-}}
155 \tkzInit[xmax=15,ymax=15]
156 \tkzClip
157 \tkzGrid[sub,color=orange]
158 \tkzLabelX[label= ] \tkzLabelY[label= ]
159 \tkzDrawXY
160 \node[opacity=.5] at (8,6){%
161 \includegraphics[scale=.5]{tiger}};
162 \end{tikzpicture}
163 \end{tkzexample}
164
165
166 \endinput