# Surface plot with addplot3 from data structured as a sequence of (x,y,z) numbers

How to build surface with addplor3 pgfplot function with data structured in 3 cols, i.e. x, y, z columns.

\begin{tikzpicture}
\begin{axis}[
width=0.90\textwidth,
height=0.90\textwidth,
]
%
table[
x=XX,
y=YY,
z=ZZ,
col sep=comma]{3D.csv};%
\end{axis}
%
\end{tikzpicture}


Where data into 3D.csv are structured as:

XX,YY,ZZ
0,0,0
1,1,0
2,2,0
3,3,0
0.5,0.5,1
1.5,1.5,1
2.5,2.5,1
3.5,3.5,1
0.75,0.75,2
1.75,1.75,2
2.75,2.75,2
3.75,3.75,2


The data above is just to exemplify and, bellow, follows a image with generated from the real data. Note that instead a surface the image has many connected lines.

• My guess is that you have to denote the values for each element in the matrix (i.e., the surface) to get a surface. Nevertheless, if you find the answers to your previous questions useful, consider accepting them by clicking the tick-mark below the vote button. – Raaja Sep 11 at 13:14
• This figure doesn't have much to do with the data. If you provide "realistic" data, you can, provided you prepare it appropriated, as @Raaja mentions, a realistic output. – Schrödinger's cat Sep 11 at 14:41
• I need to disagree with you. The data is totally realistic and it is in a totally expected format, which is a table format. I am working with pandas and getting these data from its objects. Therefore, it is really annoying the necessity to implement scripts that will transform the data stored in a totally intuitive way to the mesh or coordinate format. And worst, for that, I will not be able to use to_csv pandas method because it does not contemplate the necessary data arrangements. What ever. Probably it is not just a good idea to use pgfplot here. – Randerson Sep 11 at 15:04
• @Randerson Please note that that TEX is not a data-processing tool, so its upto the user to input the data in whatsoever format they wish. And, plotting a mesh in a matrix cooridnate is more intuitive than plotting it in some another format (which might be intuitive for other cases). PS: you can also process the data in TEX, but think about whether it is worth the effort. Instead you can pre-process the data in TEX preferred format to avoid hassles ;) for more info: tex.stackexchange.com/questions/104248/… – Raaja Sep 11 at 16:16