Seite 1 von 1

addplot Latex tikzpicture

Verfasst: Mi 12. Mär 2014, 12:52
von tramadalGast
Hallo liebe Latex Helfer,
ich will einen 2D Plot aus einer Tabelle mit 3 Koordinaten (x,y Koordinaten und z=Farbe) machen. Hierbei soll ein surface durch interpolation zwischen den z-Werten entsteht.

Tabelle: nodes.dat
X Y Z
-44.0651 2343.99 -98.3899
55.9848 2368.11 137.286
-75.7082 2102.19 -64.2877
88.9038 2102.33 134.792
-111.614 1626.88 -0.0321223
119.607 1626.87 107.971
usw...

Mein Versuch:
\documentclass[12pt,a4paper]{book}%article: für mittelgroße und 
\usepackage[ table ]{ xcolor }
\usepackage{tikz}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.3}
\usepgfplotslibrary{patchplots} % LATEX and plain TEX
\usepgfplotslibrary[patchplots] % ConTEXt
\usetikzlibrary{pgfplots.patchplots} % LATEX and plain TEX
\usetikzlibrary[pgfplots.patchplots] % ConTEXt

\begin{document}

\begin{tikzpicture}
\begin{axis}[
	nodes near coords={(\coordindex)},
	title=My Diagramm
	]
\addplot3[
	patch,
	patch type=biquadratic,
	shader=interp,
	point meta=explicit
	]
	table[x=X, y=Y, z=Z]{nodes.dat};
%	coordinates {
%(0,0) [1] (6,1) [2] (5,5) [3] (-1,5) [4]
%(3,1) [1] (6,3) [2] (2,6) [3] (0,3) [4]
%(3,3.75) [4]
%};%hiermit geht es fuer addplot...
\end{axis}
\end{tikzpicture}

\end{document}
Leider geht das nicht und ich finde leider kein anderes Beispiel an dem ich mich orientieren kann...

Verfasst: Do 13. Mär 2014, 13:03
von sudo
Kannst du bitte auch das Beispiel und die Fehlermeldung angeben?

addplot3[] table{};

Verfasst: Do 13. Mär 2014, 15:51
von tramadal
Hallo,

ich versuche einen Plot zu erstellen. Hierfür habe ich bspw 6 Koordinaten in der x,y Ebene und dazu jeweils einen z Wert der durch eine Farbe f(z) dargestellt werden soll...
Ich versuche das folgende Beispiel umzubauen, bekomme es aber nicht hin die daten aus einer externen Datei einlesen zu lassen.
\documentclass[12pt,a4paper]{book}%article: für mittelgroße und 
\usepackage[ table ]{ xcolor }
\usepackage{tikz}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.9}
\usepgfplotslibrary{patchplots} % LATEX and plain TEX
\usepgfplotslibrary[patchplots] % ConTEXt
\usetikzlibrary{pgfplots.patchplots} % LATEX and plain TEX
\usetikzlibrary[pgfplots.patchplots] % ConTEXt

\begin{document}

\pgfplotsset{width=8cm,compat=1.5.1}
\begin{tikzpicture}
\begin{axis}[nodes near coords={(\coordindex)},
title=Quadratic Triangle]
\addplot[patch,patch type=triangle quadr,
shader=interp,point meta=explicit]
coordinates {
(0,0) [1] (5,4) [2] (0,7) [3]
(2,3) [1] (3,6) [2] (-1,4) [3]
};
\end{axis}
\end{tikzpicture}

\end{document}
Ich hoffe auf eure Hilfe!
Vielen Dank!...

Verfasst: So 23. Mär 2014, 14:54
von esdd
Bei mir funktioniert
\documentclass[margin=5mm]{standalone} 
\usepackage{pgfplots}
\pgfplotsset{compat=1.10} 
\usepgfplotslibrary{patchplots} 
\usepackage{filecontents}
% Erstellen der Datei nodes.dat
\begin{filecontents}{nodes.dat}
  X   Y   C
  0   0   1
  5   4   2
  0   7   3
  2   3   1
  3   6   2
 -1   4   3
\end{filecontents}

\begin{document} 
\begin{tikzpicture} 
  \begin{axis}[nodes near coords={(\coordindex)},title=Quadratic Triangle] 
  \addplot[patch,patch type=triangle quadr, shader=interp,point meta=explicit] 
      table[x=X,y=Y,meta=C]{daten.dat};
  \end{axis} 
\end{tikzpicture} 
\end{document}
wie erwartet. Wichtig ist, dass bei beim Einlesen der Tabelle vor dem Dateinamen kein Leerzeichen eingefügt wird.
Gruß
Elke