summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgfplots/test/pgfplotstest/pgfplotstest.plottypes.tex
blob: 7198e85dea2fecd58856735d10dc4fc49ce36acf (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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
\testfile{pgfplotstest.plottypes.tex}
\testsection{Stacked plots}
%\pgfplotsset{every axis/.append style={reverse stacked plots=false}}
\testsubsection{stack y, sharp plot}
\begin{tikzpicture}
%\tracingmacros=2\tracingcommands=2
	\begin{axis}[stack plots=y,
		legend style={at={(0.03,0.97)},anchor=north west}
	]
	\addplot coordinates {(0,0) (1,1) (2,1) (3,2)};
	\addplot coordinates {(0,0) (1,1) (2,1) (3,2)};
	\addplot coordinates {(0,0) (1,1) (2,1) (3,2)};
	\legend{1,2,3}%
	\end{axis}
%\tracingmacros=0\tracingcommands=0
\end{tikzpicture}

\testsubsubsection{with closedcycle}
\begingroup
\def\example#1{%
\begin{tikzpicture}
	\begin{axis}[stack plots=y,
		legend style={at={(0.03,0.97)},anchor=north west}
	]
	\addplot+[#1] coordinates {(0,0) (1,1) (2,1) (3,2)} \closedcycle;
	\addplot+[#1] coordinates {(0,0) (1,1) (2,1) (3,2)} \closedcycle;
	\addplot+[#1] coordinates {(0,0) (1,1) (2,1) (3,2)} \closedcycle;
	\legend{1,2,3}%
	\end{axis}
\end{tikzpicture}
}

\example{}

\example{fill}
\endgroup

\testsubsubsection{with closedcycle and const plots}
\begingroup
\def\example#1{%
\begin{tikzpicture}[#1]
	\begin{axis}[stack plots=y,
		legend style={at={(0.03,0.97)},anchor=north west}
	]
	\addplot+[fill] coordinates {(0,0.5) (1,1) (2,1) (3,2) (4,2)}  \closedcycle;
	\addplot+[fill] coordinates {(0,0.5) (1,1) (2,1) (3,2) (4,2)} \closedcycle;
	\addplot+[fill] coordinates {(0,0.5) (1,1) (2,1) (3,2) (4,2)} \closedcycle;
	\legend{1,2,3}%
	\end{axis}
\end{tikzpicture}
}

\example{const plot mark left}

\example{const plot mark right}
\endgroup

\testsubsection{stack y, ybar}
\begin{tikzpicture}
	\begin{axis}[
		ybar stacked,
		legend style={at={(0.03,0.97)},anchor=north west},
	]
	\addplot coordinates {(0,0) (1,1) (2,1) (3,2)};
	\addplot coordinates {(0,0) (1,1) (2,1) (3,2)};
	\addplot coordinates {(0,0) (1,1) (2,1) (3,2)};
	\legend{1,2,3}%
	\end{axis}
\end{tikzpicture}

\testsubsection{stack y, ybar, minus}
\begin{tikzpicture}
	\begin{axis}[
		ybar stacked=minus,
	]
	\addplot coordinates {(0,0) (1,1) (2,1) (3,2)};
	\addplot coordinates {(0,0) (1,1) (2,1) (3,2)};
	\addplot coordinates {(0,0) (1,1) (2,1) (3,2)};
	\legend{1,2,3}%
	\end{axis}
\end{tikzpicture}

\testsubsection{stack x, sharp plot [not useful]}
\begin{tikzpicture}
%\tracingmacros=2\tracingcommands=2
	\begin{axis}[stack plots=x,
		legend style={at={(0.97,0.03)},anchor=south east},
		xtick={0,...,30},
	]
	\addplot coordinates {(2,0) (1,1) (1,2) (3,3)};
	\addplot coordinates {(2,0) (1,1) (1,2) (3,3)};
	\addplot coordinates {(2,0) (1,1) (1,2) (3,3)};
	\legend{1,2,3}%
	\end{axis}
%\tracingmacros=0\tracingcommands=0
\end{tikzpicture}

\testsubsection{stack x, xbar}
\begin{tikzpicture}
	\begin{axis}[
		xbar stacked,
		xtick={0,...,30},
		legend style={at={(0.97,0.03)},anchor=south east},
	]
	\addplot coordinates {(2,0) (1,1) (1,2) (3,3)};
	\addplot coordinates {(2,0) (1,1) (1,2) (3,3)};
	\addplot coordinates {(2,0) (1,1) (1,2) (3,3)};
	\legend{1,2,3}%
	\end{axis}
\end{tikzpicture}

\testsubsection{stack x, xbar, minus}
\begin{tikzpicture}
	\begin{axis}[xbar stacked=minus]
	\addplot coordinates {(2,0) (1,1) (1,2) (3,3)};
	\addplot coordinates {(2,0) (1,1) (1,2) (3,3)};
	\addplot coordinates {(2,0) (1,1) (1,2) (3,3)};
	\legend{1,2,3}%
	\end{axis}
\end{tikzpicture}

\testsection{Bar diagrams}
{
\begin{tikzpicture}
	\begin{axis}[
		%xmin=1925,xmax=1975,disabledatascaling=false,
		%xtick={1930,1940,1950,1960,1970},
		x tick label style={/pgf/number format/set thousands separator=},
		ylabel=Population,
		enlargelimits=0.15,
		legend style={at={(0.5,-0.1)},anchor=north,legend columns=-1},
		ybar,
	]
%\tracingmacros=2\tracingcommands=2
	\addplot[draw=blue,mark=none,fill=blue!80!black] 
		plot coordinates {(1930,50e6) (1940,33e6) (1950,40e6) (1960,50e6) (1970,70e6)};
	\addlegendentry{FarFarAway}

	\addplot[mark=none,red,fill=red!80!black] 
		plot coordinates {(1930,38e6) (1940,42e6) (1950,43e6) (1960,45e6) (1970,65e6)};
	\addlegendentry{NotSoFar}

	\addplot[mark=none,brown,fill=brown!80!black] 
		plot coordinates {(1930,15e6) (1940,12e6) (1950,13e6) (1960,25e6) (1970,35e6)};
	\addlegendentry{Near}
	\end{axis}
\end{tikzpicture}

\testsubsection{Interval bar handlers}
\begin{tikzpicture}
	\begin{axis}[
		x tick label style={/pgf/number format/set thousands separator=},
		ylabel=Population,
		enlargelimits=0.05,
		legend style={at={(0.5,-0.1)},anchor=north,legend columns=-1},
		ybar interval=0.7,
	]
	\addplot[draw=blue,mark=none,fill=blue!80!black]
		plot coordinates {(1930,50e6) (1940,33e6) (1950,40e6) (1960,50e6) (1970,70e6) (1980,70e6)};
	\addlegendentry{FarFarAway}

	\addplot[mark=none,red,fill=red!80!black] 
		plot coordinates {(1930,38e6) (1940,42e6) (1950,43e6) (1960,45e6) (1970,65e6) (1980,70e6)};
	\addlegendentry{NotSoFar}

	\addplot[mark=none,brown,fill=brown!80!black] 
		plot coordinates {(1930,15e6) (1940,12e6) (1950,13e6) (1960,25e6) (1970,35e6) (1980,70e6)};
	\addlegendentry{Near}
	\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{axis}[
	xmin=0,xmax=53,
		ylabel=Age,
		xlabel=Quantity,
		y label style={yshift=0.7cm},
		enlargelimits=false,
		ytick={5,10,13,18,21,25,30,50,70},
		yticklabel={$\pgfmathprintnumber{\tick}$ -- $\pgfmathprintnumber{\nexttick}$},
		xbar interval,
	]
	\addplot[draw=blue,mark=none,fill=blue!80!black]
		plot coordinates {(10,5) (10.5,10) (15,13) (24,18) (50,21) (23,25) (10,30) (3,50) (3,70)};
	\end{axis}
\end{tikzpicture}


\testsection{const plot}
\begin{tikzpicture}
	\begin{axis}
	\addplot+[const plot]
		coordinates {(0,0.1) (0.1,0.2) (0.2,0.2) (0.3,0.5) (0.4,0.45) (0.5,1) (0.6,1) (0.7,0.1) (0.8,0.15) (0.9,0.2) (1,0.2)};
	\end{axis}
\end{tikzpicture}

\testsection{const plot mark right}
\begin{tikzpicture}
	\begin{axis}
	\addplot+[const plot mark right]
		coordinates {(0,0.1) (0.1,0.2) (0.2,0.2) (0.3,0.5) (0.4,0.45) (0.5,1) (0.6,1) (0.7,0.1) (0.8,0.15) (0.9,0.2) (1,0.2)};
	\end{axis}
\end{tikzpicture}

\testsection{jump mark right}
\begin{tikzpicture}
	\begin{axis}
	\addplot+[jump mark right]
		coordinates {(0,0.1) (0.1,0.2) (0.2,0.2) (0.3,0.5) (0.4,0.45) (0.5,1) (0.6,1) (0.7,0.1) (0.8,0.15) (0.9,0.2) (1,0.2)};
	\end{axis}
\end{tikzpicture}

\testsection{jump mark left}
\begin{tikzpicture}
	\begin{axis}
	\addplot+[jump mark left]
		coordinates {(0,0.1) (0.1,0.2) (0.2,0.2) (0.3,0.5) (0.4,0.45) (0.5,1) (0.6,1) (0.7,0.1) (0.8,0.15) (0.9,0.2) (1,0.2)};
	\end{axis}
\end{tikzpicture}