1

Hi I am currently learning how to do plots in Tex and I found a problem which I cant solve. I would like to do 3D surface plot from file but all what I get is a 3D line. For learning purpose I used an generic example from pgfplots documentation (function of {5*x*sin(2*deg(x)) * y};) and then tried to plot it from the file which contains data of this function.

\begin{figure}[!ht]

\begin{tikzpicture}
\begin{axis}[grid=major,
colormap/greenyellow]

\addplot3[surf,mesh/ordering=y varies]
table [x=x, y=y, z=z, col sep=tab]{3D.txt};
\end{axis}
\end{tikzpicture}

File 3D.txt contains:

z   x   y
0   0   0
0.001247918 0.05    0.05
0.009933467 0.1 0.1
0.033246023 0.15    0.15
0.077883668 0.2 0.2
0.149820481 0.25    0.25
0.254089113 0.3 0.3
0.394583333 0.35    0.35
0.573884873 0.4 0.4
0.793118496 0.45    0.45
1.051838731 0.5 0.5
1.347951132 0.55    0.55
1.677670355 0.6 0.6
2.035516667 0.65    0.65
2.414351838 0.7 0.7
2.80545465  0.75    0.75
3.19863553  0.8 0.8
3.582389128 0.85    0.85
3.944082905 0.9 0.9
4.270179146 0.95    0.95
4.546487134 1   1

Then what I get is on the figure 1Plot What I get

and it should be like this

Plot what I want to get

I am very thankful for your advices.

closed as off-topic by Stefan Pinnow, R. Schumacher, Zarko, Symbol 1, user36296 Oct 30 '16 at 20:48

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    You only have z values for y=x, so there are not enough values to generate a surface. – erik Apr 6 '15 at 20:21
  • You are right. I Solved it, it needs values (z,y) for each x. I did not realize it. Thank you. – Tomáš Števček Apr 8 '15 at 9:44
  • 4
    I'm voting to close this question as off-topic because it was solved in the comments. – Stefan Pinnow Oct 30 '16 at 20:07

Browse other questions tagged or ask your own question.