2

I have 5 Lines each with a varies values in y. The line in the middle (z constant = 30), The bottom two lines (left and right) are constant at z=0. The other 2 lines constant at z=15. For a give x-value I get for the 5 functions different varies values in y and the values in Z are (0,15,30,15,0).

I would like to present a surface mesh.

schematic Surface in Maple

In Maple the plot does not fit all values, its just a statistic plot, to show what I want. The next is the plot in Latex but the triangle are wrong. So I'm sure the is only little things to change... Perhaps the order of meshing.

A few things I 've tried , but I can not do it.

In Latex, no surface or mesh

\documentclass{scrreprt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{pgfplots}
\usepgfplotslibrary{patchplots}
\usetikzlibrary{calc}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   \begin{filecontents*}{matrixv3.txt}
     -49.231          46.658           0.000    
 -49.231           6.658           5.000    
 -49.231         -33.342          10.000    
 -49.231         -73.342           5.000    
 -49.231        -113.342           0.000    
 -49.231         -73.342          -5.000    
 -49.231         -33.342         -10.000    
 -49.231         -73.342          -5.000    
 -98.462          33.473           0.000    
 -98.462          -6.527           5.000    
 -98.462         -46.527          10.000    
 -98.462         -86.527           5.000    
 -98.462        -126.527           0.000    
 -98.462         -86.527          -5.000    
 -98.462         -46.527         -10.000    
 -98.462         -86.527          -5.000    
-147.692          31.720           0.000    
-147.692          -8.280           5.000    
-147.692         -48.280          10.000    
-147.692         -88.280           5.000    
-147.692        -128.280           0.000    
-147.692         -88.280          -5.000    
-147.692         -48.280         -10.000    
-147.692         -88.280          -5.000    
-196.923          36.156           0.000    
-196.923          -3.844           5.000    
-196.923         -43.844          10.000    
-196.923         -83.844           5.000    
-196.923        -123.844           0.000    
-196.923         -83.844          -5.000    
-196.923         -43.844         -10.000    
-196.923         -83.844          -5.000    
-246.154          43.048           0.000    
-246.154           3.048           5.000    
-246.154         -36.952          10.000    
-246.154         -76.952           5.000    
-246.154        -116.952           0.000    
-246.154         -76.952          -5.000    
-246.154         -36.952         -10.000    
-246.154         -76.952          -5.000    
-295.385          49.961           0.000    
-295.385           9.961           5.000    
-295.385         -30.039          10.000    
-295.385         -70.039           5.000    
-295.385        -110.039           0.000    
-295.385         -70.039          -5.000    
-295.385         -30.039         -10.000    
-295.385         -70.039          -5.000    
-344.615          55.529           0.000    
-344.615          15.529           5.000    
-344.615         -24.471          10.000    
-344.615         -64.471           5.000    
-344.615        -104.471           0.000    
-344.615         -64.471          -5.000    
-344.615         -24.471         -10.000    
-344.615         -64.471          -5.000    
-393.846          59.241           0.000    
-393.846          19.241           5.000    
-393.846         -20.759          10.000    
-393.846         -60.759           5.000    
-393.846        -100.759           0.000    
-393.846         -60.759          -5.000    
-393.846         -20.759         -10.000    
-393.846         -60.759          -5.000    
-443.077          61.218           0.000    
-443.077          21.218           5.000    
-443.077         -18.782          10.000    
-443.077         -58.782           5.000    
-443.077         -98.782           0.000    
-443.077         -58.782          -5.000    
-443.077         -18.782         -10.000    
-443.077         -58.782          -5.000    
-492.308          61.994           0.000    
-492.308          21.994           5.000    
-492.308         -18.006          10.000    
-492.308         -58.006           5.000    
-492.308         -98.006           0.000    
-492.308         -58.006          -5.000    
-492.308         -18.006         -10.000    
-492.308         -58.006          -5.000    
-541.538          62.294           0.000    
-541.538          22.294           5.000    
-541.538         -17.706          10.000    
-541.538         -57.706           5.000    
-541.538         -97.706           0.000    
-541.538         -57.706          -5.000    
-541.538         -17.706         -10.000    
-541.538         -57.706          -5.000    
-590.769          62.818           0.000    
-590.769          22.818           5.000    
-590.769         -17.182          10.000    
-590.769         -57.182           5.000    
-590.769         -97.182           0.000    
-590.769         -57.182          -5.000    
-590.769         -17.182         -10.000    
-590.769         -57.182          -5.000    
-640.000          64.016           0.000    
-640.000          24.016           5.000    
-640.000         -15.984          10.000    
-640.000         -55.984           5.000    
-640.000         -95.984           0.000    
-640.000         -55.984          -5.000    
-640.000         -15.984         -10.000    
-640.000         -55.984          -5.000    
\end{filecontents*}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{figure}[htb]
\centering
\pgfplotsset{streuung/.style={%
compat=1.10,
colormap={whitered}{color(0cm)=(white); color(1cm)=(black!70!gray)},
view = {70}{25},
axis equal image,
axis lines=center,
every axis x label/.style={at={(axis cs:\pgfkeysvalueof{/pgfplots/xmax},0,0)},xshift=-1em},
every axis y label/.style={at={(axis cs:0,\pgfkeysvalueof{/pgfplots/ymax},0)},xshift=2ex},
every axis z label/.style={at={(axis cs:0,0,\pgfkeysvalueof{/pgfplots/zmax})},xshift=1em},
xmin=-650 , xmax=0,
ymin=-200, ymax= 100,
zmin=0, zmax= 30,
ticks=none,
width=0.7\linewidth,
clip mode=individual,}}    
\begin{tikzpicture}
\begin{axis}[streuung]
\addplot3+[patch, mark=none, opacity=0.5, patch type=triangle ,patch refines={1},line width=0.05pt] file {matrixv3.txt};   
\end{axis}
\end{tikzpicture}
\end{figure}

\end{document}

What I have to change that I get a surface in Latex? The underground at z=0 could be closed, the same for the faces at x=-600 and x=0.

Thanks a lot! I am very thankful for your advices.

1

If you read the section in the manual pgfplots.pdf about the patch option, you will find that the file is read three lines at a time. Each consecutive triple of points defines one triangle. That is, lines one to three define triangle one, lines four to six define triangle two, and so on. And this is what you get.

If you want to use patch to draw a triangulated surface, you need to add a lot more lines to your data file. Probably, you are better off using the surf option instead of the patch option. See the corresponding section in pgfplots.pdf and also the question Colormap with Tikz for an example (and how to convince pgfplots not to interpret the data as linear data, but as surface data).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.