Überarbeitungsverlauf[Zurück]
Klicke auf Einblenden/Ausblenden von Überarbeitungen 2

13 Sep '18, 13:47

cis's gravatar image

cis
9.6k104461491

pgfplots: pgfplots (patch plot): Verwendung von Farben aus der colormap

Warum werden für eine `colormap` colormap={mycolormap}{ color(0)=(black); color(1)=(blue); color(2)=(red); color(3)=(orange); %color(10)=(black) % }, trotz der Einstellung colormap access= piecewise constant die Farben nicht scharf getroffen? Bei `red` und `orange` sieht man Abweichungen. [![alt text][1]][1] \documentclass[margin=5mm, tikz]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{patchplots} \pgfplotsset{compat=1.13} \begin{document} \pgfplotsset{ colormap access= % map %direct piecewise constant %piecewise linear } % /pgfplots/colormap access=mapjdirectjpiecewise constantjpiecewise linear \begin{tikzpicture} \begin{axis}[hide axis, colorbar, % Versuch 1: %colormap={test}% % { % [0.1cm] % colormap steps: 1cm % color(0cm)=(black); color(0.1cm)=(black); % color(0.1cm)=(blue); color(1.1cm)=(blue); % color(1.1cm)=(red); color(2.1cm)=(red); % color(2.1cm)=(orange); color(3.1cm)=(orange); % % color(4)=(orange); color(12)=(black); % } % Versuch 2: colormap={mycolormap}{ color(0)=(black); color(1)=(blue); color(2)=(red); color(3)=(orange); %color(10)=(black) % }, point meta min=0, point meta max=3, %point meta = explicit symbolic, mesh/color input=colormap ] \addplot+[ ultra thick, % Punkte mark size=1.125pt, mark options={red}, table/row sep=\\, % Muss wohl so sein!? % patch, % Plot-Typ patch type=polygon, vertex count=2, % damit nur Kanten, keine Flächen, gezeichnet werden % % Angabe der Verbindungskanten ===================== patch table with point meta={% Startpkt Endpkt colordata \\% 1 2 0\\% Default; SOLL: black 1 7 1\\% SOLL: blue 2 4 2\\% SOLL: red 3 4 3\\% SOLL: orange 4 6 0\\% SOLL: black 5 4 \\% 5 7 \\% 6 4 \\% 6 7 \\% 7 7 \\% 8 8 \\% } % Angabe der Koordinaten ===================== ] table[header=true, x index=1, y index=2, row sep=\\] { Nr x y \\ 0 0 0 \\%0 1 2 2 \\%1 2 0 1 \\%2 3 0 0 \\%3 4 1 0 \\%4 5 2 0 \\%5 6 2 0 \\%6 7 1 1 \\%7 8 0 2 \\%8 }; % Beschriftungen ============================ % Laut Handbuch "replicate the vertex list to show \coordindex" % Anzeigen des 0. Aliaspunktes verhindern: \newcommand\Punktnummer{\pgfmathparse{\punktnummer>0 ? \punktnummer : ""}\pgfmathresult} \addplot[only marks, visualization depends on={value \thisrowno{0} \as \punktnummer}, visualization depends on={value \thisrowno{3} \as \Anker}, nodes near coords={\Punktnummer}, % every node near coord/.append style={ font=\sffamily\scriptsize, text=black, anchor=\Anker }, ] table[header=true, x index=1, y index=2, row sep=\\] { Nr x y Textposition \\ 0 0 0 south \\%0: 0. Aliaspunkt & south als Default für Standardposition 1 2 2 \\%1 2 0 1 \\%2 3 0 0 \\%3 4 1 0 \\%4 5 2 0 \\%5 6 2 0 north \\%6 Geänderte Textposition 7 1 1 south \\%7 Default wiederholen 8 0 2 \\%8 }; % Beschriftungen ============================ \end{axis} \end{tikzpicture} \end{document} [1]: https://texwelt.de/wissen/upfiles/55555555_197.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

03 Sep '18, 15:25

cis's gravatar image

cis
9.6k104461491

pgfplots: Verwendung von Farben aus der colormap

Warum werden für eine `colormap` colormap={mycolormap}{ color(0)=(black); color(1)=(blue); color(2)=(red); color(3)=(orange); %color(10)=(black) % }, trotz der Einstellung colormap access= piecewise constant die Farben nicht scharf getroffen? Bei `red` und `orange` sieht man Abweichungen. [![alt text][1]][1] \documentclass[margin=5mm, tikz]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{patchplots} \pgfplotsset{compat=1.13} \begin{document} \pgfplotsset{ colormap access= % map %direct piecewise constant %piecewise linear } % /pgfplots/colormap access=mapjdirectjpiecewise constantjpiecewise linear \begin{tikzpicture} \begin{axis}[hide axis, colorbar, % Versuch 1: %colormap={test}% % { % [0.1cm] % colormap steps: 1cm % color(0cm)=(black); color(0.1cm)=(black); % color(0.1cm)=(blue); color(1.1cm)=(blue); % color(1.1cm)=(red); color(2.1cm)=(red); % color(2.1cm)=(orange); color(3.1cm)=(orange); % % color(4)=(orange); color(12)=(black); % } % Versuch 2: colormap={mycolormap}{ color(0)=(black); color(1)=(blue); color(2)=(red); color(3)=(orange); %color(10)=(black) % }, point meta min=0, point meta max=3, %point meta = explicit symbolic, mesh/color input=colormap ] \addplot+[ ultra thick, % Punkte mark size=1.125pt, mark options={red}, table/row sep=\\, % Muss wohl so sein!? % patch, % Plot-Typ patch type=polygon, vertex count=2, % damit nur Kanten, keine Flächen, gezeichnet werden % % Angabe der Verbindungskanten ===================== patch table with point meta={% Startpkt Endpkt colordata \\% 1 2 0\\% Default; SOLL: black 1 7 1\\% SOLL: blue 2 4 2\\% SOLL: red 3 4 3\\% SOLL: orange 4 6 0\\% SOLL: black 5 4 \\% 5 7 \\% 6 4 \\% 6 7 \\% 7 7 \\% 8 8 \\% } % Angabe der Koordinaten ===================== ] table[header=true, x index=1, y index=2, row sep=\\] { Nr x y \\ 0 0 0 \\%0 1 2 2 \\%1 2 0 1 \\%2 3 0 0 \\%3 4 1 0 \\%4 5 2 0 \\%5 6 2 0 \\%6 7 1 1 \\%7 8 0 2 \\%8 }; % Beschriftungen ============================ % Laut Handbuch "replicate the vertex list to show \coordindex" % Anzeigen des 0. Aliaspunktes verhindern: \newcommand\Punktnummer{\pgfmathparse{\punktnummer>0 ? \punktnummer : ""}\pgfmathresult} \addplot[only marks, visualization depends on={value \thisrowno{0} \as \punktnummer}, visualization depends on={value \thisrowno{3} \as \Anker}, nodes near coords={\Punktnummer}, % every node near coord/.append style={ font=\sffamily\scriptsize, text=black, anchor=\Anker }, ] table[header=true, x index=1, y index=2, row sep=\\] { Nr x y Textposition \\ 0 0 0 south \\%0: 0. Aliaspunkt & south als Default für Standardposition 1 2 2 \\%1 2 0 1 \\%2 3 0 0 \\%3 4 1 0 \\%4 5 2 0 \\%5 6 2 0 north \\%6 Geänderte Textposition 7 1 1 south \\%7 Default wiederholen 8 0 2 \\%8 }; % Beschriftungen ============================ \end{axis} \end{tikzpicture} \end{document} [1]: https://texwelt.de/wissen/upfiles/55555555_197.png