I was trying to understand how the programming tools work on Latex in the tikzpicture environment. Can someone explain me how to reduce this big code to a cleaner version that can be write with a simpler and less "manual" code?
Thanks for helping! E
\documentclass[]{standalone}
%for pgf images
\usepackage{amsmath}
\usepackage{tikz} % To generate the plot from csv
\usetikzlibrary{positioning}
\usepackage{pgfplots}
%
\definecolor{mycolor1}{rgb}{0.23921,0.86274,0.59215}%
%
\begin{document}
%
\begin{tikzpicture}
\begin{axis}[%
width=5cm,
height=5cm,
scale only axis,
plot box ratio=1 1 1,
point meta min=1,
point meta max=2,
%unbounded coords=jump,
xmin=0.5,
xmax=1.5,
xtick={\empty},
tick align=outside,
y dir=reverse,
ymin=0.5,
ymax=15,
ytick={ 0, 5, 10, 15},
zmin=0,
zmax=56.5486677646163,
ztick={18.8495559215388,37.6991118430775,56.5486677646163},
zticklabels={{},{},{},{},{},{}},
view={-130.835728529777}{25.8},
%axis background/.style={fill=white},
axis x line*=bottom,
axis y line*=left,
axis z line*=left,
xmajorgrids,
ymajorgrids,
zmajorgrids
]
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 0.5 0\\
0.5 1.5 0\\
1.5 1.5 0\\
1.5 0.5 0\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 1.5 0\\
0.5 1.5 0.698131700797732\\
1.5 1.5 0.698131700797732\\
1.5 1.5 0\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 1.5 0.698131700797732\\
0.5 2.5 0.698131700797732\\
1.5 2.5 0.698131700797732\\
1.5 1.5 0.698131700797732\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 2.5 0.698131700797732\\
0.5 2.5 1.39626340159546 \\
1.5 2.5 1.39626340159546 \\
1.5 2.5 0.698131700797732\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 2.5 1.39626340159546\\
0.5 3.5 1.39626340159546\\
1.5 3.5 1.39626340159546\\
1.5 2.5 1.39626340159546\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 3.5 1.39626340159546\\
0.5 3.5 2.0943951023932\\
1.5 3.5 2.0943951023932\\
1.5 3.5 1.39626340159546\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 3.5 2.0943951023932\\
0.5 4.5 2.0943951023932\\
1.5 4.5 2.0943951023932\\
1.5 3.5 2.0943951023932\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 4.5 2.0943951023932\\
0.5 4.5 2.79252680319093\\
1.5 4.5 2.79252680319093\\
1.5 4.5 2.0943951023932\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 4.5 2.79252680319093\\
0.5 5.5 2.79252680319093\\
1.5 5.5 2.79252680319093\\
1.5 4.5 2.79252680319093\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 5.5 2.79252680319093\\
0.5 5.5 3.49065850398866\\
1.5 5.5 3.49065850398866\\
1.5 5.5 2.79252680319093\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 5.5 3.49065850398866\\
0.5 6.5 3.49065850398866\\
1.5 6.5 3.49065850398866\\
1.5 5.5 3.49065850398866\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 6.5 3.49065850398866\\
0.5 6.5 4.18879020478639\\
1.5 6.5 4.18879020478639\\
1.5 6.5 3.49065850398866\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 6.5 4.18879020478639\\
0.5 7.5 4.18879020478639\\
1.5 7.5 4.18879020478639\\
1.5 6.5 4.18879020478639\\
};
\addplot3[%
patch,patch type=rectangle,table/row sep=\\,patch table={0 1 2 3\\}, fill=mycolor1, faceted color=black, z buffer=sort]
table[row sep=crcr] {%
x y z\\
0.5 7.5 4.18879020478639\\
0.5 7.5 4.88692190558412\\
1.5 7.5 4.88692190558412\\
1.5 7.5 4.18879020478639\\
};
\end{axis}
%\begin{axis}[%
%width=17.896in,
%height=13.688in,
%at={(0in,0in)},
%scale only axis,
%xmin=0,
%xmax=1,
%ymin=0,
%ymax=1,
%axis line style={draw=none},
%ticks=none,
%axis x line*=bottom,
%axis y line*=left
%]
%\end{axis}
\end{tikzpicture}%
\end{document}%

