1 \documentclass[tikz]{standalone} |
1 \documentclass[tikz]{standalone} |
2 \usepackage{pgfplots} |
|
3 \usepackage{tikz-3dplot} |
|
4 \usepackage[svgnames]{xcolor} |
|
5 \usepgfplotslibrary{colorbrewer} |
|
6 |
2 |
7 \def\datapath{../res/} |
3 \input{plotsetup} |
|
4 |
|
5 \def\datapath{../res/cube} |
8 |
6 |
9 \begin{document} |
7 \begin{document} |
10 |
8 |
11 \tdplotsetmaincoords{50}{25} |
9 \begin{tikzpicture} |
|
10 \pgfplotsset{ |
|
11 onlyfront/.code = \pgfplotsset{x filter/.expression={% |
|
12 or(\thisrow{face} == 2, or(\thisrow{face} == 4, \thisrow{face} == 6)) ? x : nan% |
|
13 },}, |
|
14 onlyback/.code = \pgfplotsset{x filter/.expression={% |
|
15 or(\thisrow{face} == 1, or(\thisrow{face} == 3, \thisrow{face} == 5)) ? x : nan% |
|
16 },}, |
|
17 } |
|
18 |
|
19 \begin{axis}[illustr3d] |
|
20 % Hidden edges |
|
21 \addplot3[edge] coordinates {(0, 0, 0) (0, 1, 0) (0, 1, 1) }; |
|
22 \addplot3[edge] coordinates {(0, 1, 0) (1, 1, 0) }; |
12 |
23 |
13 \def\onlyfront#1{ |
24 % Data on hidden faces |
14 \ifnum#1=2\else\ifnum#1=4\else\ifnum#1=6\else |
25 \addplot3[backdata] table[x=x,y=y,z=z] {\datapath/data.csv}; |
15 \def\pgfmathresult{} |
|
16 \fi\fi\fi} |
|
17 |
26 |
18 \def\onlyback#1{ |
27 % Iterates on hidden faces |
19 \ifnum#1=1\else\ifnum#1=3\else\ifnum#1=5\else |
|
20 \def\pgfmathresult{} |
|
21 \fi\fi\fi} |
|
22 |
|
23 \pgfplotsset{ |
|
24 % forget plot = no legend |
|
25 cube/.style = {thick, gray!50!black,forget plot}, |
|
26 onlyfront/.code = \pgfplotsset{x filter/.code={\onlyfront{\thisrow{face}}}}, |
|
27 onlyback/.code = \pgfplotsset{x filter/.code={\onlyback{\thisrow{face}}}}, |
|
28 data/.style = {mark=*, blue, only marks}, |
|
29 backdata/.style = {mark=*, blue!30!white, only marks, onlyback, forget plot}, |
|
30 iter1/.style = {mark=x, red}, |
|
31 iter2/.style = {mark=star, BlueViolet}, |
|
32 iter3/.style = {mark=asterisk, purple}, |
|
33 backiter1/.style = {mark=x, red!30!white, onlyback, forget plot}, |
|
34 backiter2/.style = {mark=star, BlueViolet!30!white, onlyback, forget plot}, |
|
35 backiter3/.style = {mark=asterisk, purple!30!white, onlyback, forget plot}, |
|
36 origin/.style = {mark=o, green, only marks, thick}, |
|
37 surfstyle/.style = {very nearly opaque, forget plot}, |
|
38 legend style = { |
|
39 inner sep = 0pt, |
|
40 outer xsep = 5pt, |
|
41 outer ysep = 0pt, |
|
42 legend cell align = left, |
|
43 align = left, |
|
44 draw = none, |
|
45 fill = none, |
|
46 font = \small |
|
47 }, |
|
48 illustr3d/.style = { |
|
49 axis equal, |
|
50 width=5cm, |
|
51 height=5cm, |
|
52 scale only axis, |
|
53 enlargelimits=false, |
|
54 colormap access=map, |
|
55 colormap/Paired, |
|
56 colorbar, |
|
57 point meta rel=axis wide, |
|
58 shader = interp, |
|
59 xlabel = {$x$}, |
|
60 ylabel = {$y$}, |
|
61 zlabel = {$z$}, |
|
62 ticks = none, |
|
63 axis line style = {draw=none}, |
|
64 %axis x line = none, |
|
65 %axis y line = none, |
|
66 %axis z line = none, |
|
67 legend columns = 3, |
|
68 legend style = { |
|
69 at = {(0.5, 1.1)}, |
|
70 anchor = north, |
|
71 column sep = 1ex, |
|
72 }, |
|
73 mark size=1.5pt, |
|
74 } |
|
75 } |
|
76 |
|
77 \begin{tikzpicture} |
|
78 \begin{axis}[illustr3d] |
|
79 \addplot3[cube] coordinates {(0, 0, 0) (0, 1, 0) (0, 1, 1) }; |
|
80 \addplot3[cube] coordinates {(0, 1, 0) (1, 1, 0) }; |
|
81 \addplot3[backdata] table[x=x,y=y,z=z] {\datapath/data.csv}; |
|
82 \addplot3[backiter1] table[x=x,y=y,z=z] {\datapath/x1_log.csv}; |
28 \addplot3[backiter1] table[x=x,y=y,z=z] {\datapath/x1_log.csv}; |
83 \addplot3[backiter2] table[x=x,y=y,z=z] {\datapath/x2_log.csv}; |
29 \addplot3[backiter2] table[x=x,y=y,z=z] {\datapath/x2_log.csv}; |
84 \addplot3[backiter3] table[x=x,y=y,z=z] {\datapath/x3_log.csv}; |
30 \addplot3[backiter3] table[x=x,y=y,z=z] {\datapath/x3_log.csv}; |
85 |
31 |
|
32 % Surface |
86 \addplot3[ |
33 \addplot3[ |
87 surf, |
34 surf, |
88 mesh/ordering=x varies, |
35 mesh/ordering=x varies, % the second input coordinate stays fixed while first varies |
89 mesh/cols=32, |
36 mesh/cols=32, % number of first input coordinate points untils second changes |
90 mesh/rows=32, |
|
91 surfstyle, |
37 surfstyle, |
92 ] table [ |
38 ] table [ |
93 x = u, |
39 x = u, |
94 z = v, |
40 z = v, |
95 y expr = 0.0, |
41 y expr = 0.0, |
96 point meta = \thisrow{value}, |
42 point meta = \thisrow{value}, |
97 ] {\datapath/F4.csv}; |
43 ] {\datapath/F4.csv}; |
98 \addplot3[ |
44 \addplot3[ |
99 surf, |
45 surf, |
100 mesh/ordering=y varies, |
46 mesh/ordering=x varies, % the second input coordinate stays fixed while first varies |
101 mesh/cols=32, |
47 mesh/cols=32, % number of first input coordinate points untils second changes |
102 mesh/rows=32, |
|
103 surfstyle, |
48 surfstyle, |
104 ] table [ |
49 ] table [ |
105 x expr = 1.0, |
50 x expr = 1.0, |
106 y = u, |
51 y = u, |
107 z = v, |
52 z = v, |
108 point meta = \thisrow{value}, |
53 point meta = \thisrow{value}, |
109 ] {\datapath/F2.csv}; |
54 ] {\datapath/F2.csv}; |
110 \addplot3[ |
55 \addplot3[ |
111 surf, |
56 surf, |
112 mesh/ordering=x varies, |
57 mesh/ordering=x varies, % the second input coordinate stays fixed while first varies |
113 mesh/cols=32, |
58 mesh/cols=32, % number of first input coordinate points untils second changes |
114 mesh/rows=32, |
|
115 surfstyle, |
59 surfstyle, |
116 ] table [ |
60 ] table [ |
117 x = u, |
61 x = u, |
118 y = v, |
62 y = v, |
119 z expr = 1.0, |
63 z expr = 1.0, |
120 point meta = \thisrow{value}, |
64 point meta = \thisrow{value}, |
121 ] {\datapath/F6.csv}; |
65 ] {\datapath/F6.csv}; |
122 |
66 |
123 % Edges |
67 % Edges |
124 \addplot3[cube] coordinates {(0, 0, 0) (1, 0, 0) (1, 0, 1) (0, 0, 1) (0, 0, 0)}; |
68 \addplot3[edge] coordinates {(0, 0, 0) (1, 0, 0) (1, 0, 1) (0, 0, 1) (0, 0, 0)}; |
125 \addplot3[cube] coordinates {(0, 0, 1) (0, 1, 1) (1, 1, 1) (1, 0, 1)}; |
69 \addplot3[edge] coordinates {(0, 0, 1) (0, 1, 1) (1, 1, 1) (1, 0, 1)}; |
126 \addplot3[cube] coordinates {(1, 0, 0) (1, 1, 0) (1, 1, 1)}; |
70 \addplot3[edge] coordinates {(1, 0, 0) (1, 1, 0) (1, 1, 1)}; |
127 |
71 |
|
72 % Data |
128 \addplot3[data,onlyfront] table[x=x,y=y,z=z] {\datapath/data.csv}; |
73 \addplot3[data,onlyfront] table[x=x,y=y,z=z] {\datapath/data.csv}; |
129 \addlegendentry{Data} |
74 \addlegendentry{Data} |
130 |
75 |
131 \addplot3[origin,onlyfront] table[x=x,y=y,z=z] {\datapath/origin.csv}; |
76 \addplot3[origin,onlyfront] table[x=x,y=y,z=z] {\datapath/origin.csv}; |
132 \addlegendentry{Origin} |
77 \addlegendentry{Origin} |
133 |
78 |
|
79 % Iterates |
134 \addplot3[iter1,onlyfront] table[x=x,y=y,z=z] {\datapath/x1_log.csv}; |
80 \addplot3[iter1,onlyfront] table[x=x,y=y,z=z] {\datapath/x1_log.csv}; |
135 \addlegendentry{Iterates 1} |
81 \addlegendentry{Iterates 1} |
136 \addplot3[iter2,onlyfront] table[x=x,y=y,z=z] {\datapath/x2_log.csv}; |
82 \addplot3[iter2,onlyfront] table[x=x,y=y,z=z] {\datapath/x2_log.csv}; |
137 \addlegendentry{Iterates 2} |
83 \addlegendentry{Iterates 2} |
138 \addplot3[iter3,onlyfront] table[x=x,y=y,z=z] {\datapath/x3_log.csv}; |
84 \addplot3[iter3,onlyfront] table[x=x,y=y,z=z] {\datapath/x3_log.csv}; |