pgfplots error, weil prescribed mesh width nicht eingehalten

Tabellen und Grafiken erstellen und anordnen


fritze0815

pgfplots error, weil prescribed mesh width nicht eingehalten

Beitrag von fritze0815 »

Hallo,

ich erzeuge mit matlab2tikz Grafiken und bin jetzt auf ein Problem gestoßen zu dem ich keine Lösung finde.

Ich benutze in MATLAB den Befehl: patch, um Daten in 3D darzustellen. Für die Veranschaulichung von Daten nutze ich die parula-Colormap.
In der tikz-Grafik wird dann ebenfalls ein patch erzeugt. Die Colormap wird in axis definiert, genauso wie alle PatchColors.

Leider schmeißt er immer wieder den folgenden Fehler raus (relativ zufällig bei diversen Colors, nach 100 Fehlern bricht er dann ab):
! Package pgfplots Error: The provided colormap positions are not multiples of the prescribed mesh width h=1.0000000000 (found one with H/h = 0.9999/1.0000000000= 1+-0.0001 which is no integer). The error occured near 'rgb(3059pt)=(0.2081,0.1663,0.5292) (color no 3059) '.
See the pgfplots package documenation for explanation.
Leider finde ich da keine Erklärung ... oder bin zu unfähig.

Ich habe bereits in MATLAB versucht andere Colormaps zu nutzen oder alles auf 2 Nachkommastellen zu begrenzen ... alles ohne Erfolg.

Hat jemand einen heißen Tipp (ohne das patch rennt die Grafik)?

Hier noch etwas gekürzter Beispielcode aus dem tikz-standalone-file:
\documentclass[tikz]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{grffile}
\pgfplotsset{compat=1.4}
\usetikzlibrary{plotmarks}
\usepgfplotslibrary{patchplots}
\usepackage{amsmath}

\begin{document}
\definecolor{mycolor1}{rgb}{0.20810,0.16630,0.52920}%
\definecolor{mycolor2}{rgb}{0.21105,0.22554,0.65099}%
\definecolor{mycolor3}{rgb}{0.12810,0.32254,0.82801}%
\definecolor{mycolor4}{rgb}{0.00558,0.40727,0.88301}%
\definecolor{mycolor5}{rgb}{0.04018,0.44949,0.86884}%
\definecolor{mycolor6}{rgb}{0.06709,0.47959,0.85203}%
\definecolor{mycolor7}{rgb}{0.07902,0.50988,0.83546}%
\definecolor{mycolor8}{rgb}{0.07592,0.53510,0.82676}%
\definecolor{mycolor9}{rgb}{0.05889,0.56416,0.82361}%
\definecolor{mycolor10}{rgb}{0.04336,0.58407,0.82212}%
\definecolor{mycolor11}{rgb}{0.03102,0.60259,0.81812}%
\definecolor{mycolor12}{rgb}{0.02416,0.62621,0.80566}%
\definecolor{mycolor13}{rgb}{0.02323,0.63952,0.79364}%
\definecolor{mycolor14}{rgb}{0.02296,0.64557,0.78680}%
\definecolor{mycolor15}{rgb}{0.02343,0.65684,0.77200}%
\definecolor{mycolor16}{rgb}{0.02527,0.66212,0.76399}%
\definecolor{mycolor17}{rgb}{0.03523,0.67222,0.74720}%
\definecolor{mycolor18}{rgb}{0.85443,0.72957,0.33440}%
\definecolor{mycolor19}{rgb}{0.96937,0.84898,0.14681}%
%
\begin{tikzpicture}

\begin{axis}[%
width=4.521in,
height=3.566in,
at={(0.758in,0.481in)},
scale only axis,
colormap={mymap}{[1pt] rgb(0pt)=(0.2081,0.1663,0.5292); rgb(1pt)=(0.211624,0.189781,0.577676); rgb(2pt)=(0.212252,0.213771,0.626971); rgb(3pt)=(0.2081,0.2386,0.677086); rgb(4pt)=(0.195905,0.264457,0.7279); rgb(5pt)=(0.170729,0.291938,0.779248); ...

... rgb(63pt)=(0.9763,0.9831,0.0538)},
colormap={patchmap}{[1pt] rgb(0pt)=(0.473843,0.74882,0.489587); rgb(3058pt)=(0.473843,0.74882,0.489587); rgb(3059pt)=(0.2081,0.1663,0.5292) ...

... rgb(25343pt)=(0.2081,0.1663,0.5292)},
colormap={patchmap}{[1pt] rgb(0pt)=(0.2081,0.1663,0.5292); rgb(56pt)=(0.2081,0.1663,0.5292); ...

... rgb(18137pt)=(0.2081,0.1663,0.5292)},
xmin=-30,
xmax=30,
tick align=outside,
xlabel={X-Koordinaten in m},
ymin=-30,
ymax=30,
ylabel={Y-Koordinaten in m},
zmin=-10,
zmax=40,
zlabel={Z-Koordinaten in m},
view={45}{45},
hide axis,
axis x line*=bottom,
axis y line*=left,
axis z line*=left
]

\addplot3[area legend,table/row sep=crcr,patch,shader=flat corner,draw=black,colormap name=patchmap,forget plot,patch table with point meta={%
0	7	1	0\\
5	8	0	1\\
8	7	0	2\\
1	9	2	3\\
...

... 20	14	0\\
};

\addplot3[area legend,table/row sep=crcr,patch,shader=flat corner,draw=black,colormap name=patchmap,forget plot,patch table with point meta={%
1	2	0	0\\
1	0	4	1\\
4	3	1	2\\
4	0	5	3\\
...

...19.4953337261321	20	0\\
};
\addplot3 [color=mycolor1,solid,line width=1.0pt]
 table[row sep=crcr] {%
-20	-20	0\\
-20	-20	0.498165947639442\\
};
 \addplot3 [color=mycolor1,solid,line width=1.0pt]
 table[row sep=crcr] {%
-20	-20	0.498165947639442\\
-20	-20	0.998411606810022\\
}; ...

...  \addplot3 [color=mycolor1,solid,line width=1.0pt]
 table[row sep=crcr] {%
20	20	0.497448661641658\\
20	20	0\\
};
 \addplot3[only marks,mark=*,mark options={},mark size=0.5893pt,color=mycolor19] plot table[row sep=crcr]{%
-20	-20	10\\
};
\addplot3[only marks,mark=*,mark options={},mark size=0.5893pt,color=mycolor19] plot table[row sep=crcr]{%
20	-20	10\\
};
\addplot3[only marks,mark=*,mark options={},mark size=0.5893pt,color=mycolor19] plot table[row sep=crcr]{%
-20	20	10\\
};
\addplot3[only marks,mark=*,mark options={},mark size=0.5893pt,color=mycolor19] plot table[row sep=crcr]{%
20	20	10\\
};
\node[right, align=left, text=black]
at (axis cs:-20,-20,25) {10.7395};
\node[right, align=left, text=black]
at (axis cs:20,-20,25) {10.7413};
\node[right, align=left, text=black]
at (axis cs:-20,20,25) {10.7524};
\node[right, align=left, text=black]
at (axis cs:20,20,25) {10.7102};
\node[right, align=left, text=black]
at (axis cs:-20,-20,20) {1660.5116};
\node[right, align=left, text=black]
at (axis cs:20,-20,20) {1660.7914};
\node[right, align=left, text=black]
at (axis cs:-20,20,20) {1662.4947};
\node[right, align=left, text=black]
at (axis cs:20,20,20) {1655.9711};
\end{axis}
\end{tikzpicture}%
\end{document}