summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable.tex
blob: fa75e0cb81ecc422bc15e51f98813e85cf00cbc3 (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
\documentclass[a4paper]{article}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{clickable}

\begin{document}
\parindent=0pt
\parskip=30pt

\begin{tikzpicture}
	\begin{axis}[xlabel=$x$,ylabel=$y$,
		domain=-2:2,
		samples=17,
		legend style={at={(0.5,0.98)},anchor=north,legend columns=-1},
		clickable coords,
	]
		\addplot {x};
		\addplot {x^2};
		\addplot {x^3};
		\legend{$x$,$x^2$,$x^3$}
	\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{semilogyaxis}[
		xlabel=$x$,ylabel=$f(x)$,
		samples=10,
		domain=0:6,
		legend style={at={(0.5,0.98)},anchor=north,legend columns=-1},
		clickable coords,
	]
		\addplot {exp(x)};
		\addplot {10^x};
		\legend{$\exp(x)$,$10^x$}
	\end{semilogyaxis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{axis}[xlabel=$x$,ylabel=$y$,
		xmin=0,xmax=1e3,
		ymin=0,ymax=1e3,
	]
	\end{axis}
\end{tikzpicture}


\begin{tikzpicture}
	\begin{loglogaxis}[clickable coords={Level \thisrow{level} (q=\thisrow{q})}]
	\addplot table[x=dof,y=error] {
level  dof     error           q      
1      4       2.50000000e-01  48        
2      16      6.25000000e-02  25        
3      64      1.56250000e-02  41        
4      256     3.90625000e-03  8         
5      1024    9.76562500e-04  22        
6      4096    2.44140625e-04  46        
7      16384   6.10351562e-05  40        
8      65536   1.52587891e-05  3
9      262144  3.81469727e-06  1
10     1048576 9.53674316e-07  9
	};
		
	\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{axis}[
	clickable coords={(xy): \thisrow{label}},
	scatter/classes={
		a={mark=square*,blue},%
		b={mark=triangle*,red},%
		c={mark=o,draw=black}},
	]

	\addplot[scatter,only marks,
		scatter src=explicit symbolic]
	table[meta=label] {
x     y      label
0.1   0.15   a 
0.45  0.27   c 
0.02  0.17   a 
0.06  0.1    a 
0.9   0.5    b 
0.5   0.3    c 
0.85  0.52   b 
0.12  0.05   a 
0.73  0.45   b 
0.53  0.25   c 
0.76  0.5    b 
0.55  0.32   c
	};
		
	\end{axis}
\end{tikzpicture}



\begin{tikzpicture}
	\begin{loglogaxis}[clickable coords code={%
		\pgfmathprintnumberto[verbatim,precision=1]{\thisrow{error}}\pgfmathresult%
		\edef\pgfplotsretval{log error \pgfmathresult}%
		\pgfmathprintnumberto[verbatim,frac]{\thisrow{frac}}\pgfmathresult%
		\edef\pgfplotsretval{\pgfplotsretval, R=\pgfmathresult}%
	}]%
	\addplot table[x=dof,y=error] {
level  dof     error           frac      
1      4       2.50000000e-01  0.5        
2      16      6.25000000e-02  0.75      
3      64      1.56250000e-02  0.1        
4      256     3.90625000e-03  0.2         
5      1024    9.76562500e-04  0.5        
6      4096    2.44140625e-04  0.8        
7      16384   6.10351562e-05  0.125        
8      65536   1.52587891e-05  0.725
9      262144  3.81469727e-06  0.625
10     1048576 9.53674316e-07  1
	};
		
	\end{loglogaxis}
\end{tikzpicture}


\end{document}