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

18 Sep '18, 19:57

cis's gravatar image

cis
9.5k102460491

pgfplots (patch) / pgfplotstable: Datentabellen aus dem Code auslagern

**Geschlossen: Ich glaube, das geht nicht. https://sourceforge.net/p/pgfplots/bugs/193/** ___ Für einen patch plot mit (sehr) umfangreichen Tabellen habe ich eine Tabelle Kantenverbindungsdaten und eine Koordinatentabelle; letztere wird zweimal gebraucht, einmal zur Zeichnung der Punkte, einmal zur Beschriftung (`nodes near coords`). Die Tabellen auslagern mit `filecontents` will `pgfplots` nicht haben, sofern `row sep=\\` vorkommt (was hier scheints gebraucht wird...). Also dachte ich an die Verwendung von `\usepackage{pgfplotstable}`, etwa % Geht nicht ========================== \pgfplotstableread[header=true, row sep=\\] { Nr x y Textposition \\ 1 2 2 north \\%0 1 2 2 north \\%1 2 0 1 south \\%2 3 0 0 north \\%3 }\Koordinatentabelle und dann an den zwei benötigten Stellen nur noch `table[header=true, x index=1, y index=2, row sep=\\] {\Koordinatentabelle}` **Wie muss ich das richtig machen?** [![alt text][1]][1] \documentclass[margin=5mm, tikz]{standalone} \usepackage{pgfplots, pgfplotstable} \usepgfplotslibrary{patchplots} \begin{document} % Geht nicht ========================== %\pgfplotstableread[header=true, row sep=\\] { %Nr x y Textposition \\ %1 2 2 north \\%0 %1 2 2 north \\%1 %2 0 1 south \\%2 %3 0 0 north \\%3 %}\Koordinatentabelle % %\pgfplotstableread[header=true, row sep=\\] { %Startpkt Endpkt colordata \\ %1 1 \\ %2 1 \\ %3 1 \\ %}\Kantentabelle % =========================== \begin{tikzpicture} \begin{axis}[hide axis] % Koordinaten und Kantenverbindungen =========== \addplot+[ table/row sep=\\, % Muss wohl so sein!? patch, % Plot-Typ patch type=polygon, vertex count=2, % damit nur Kanten, keine Flächen, gezeichnet werden patch table with point meta={% Startpkt Endpkt colordata \\ 1 1 \\ 2 1 \\ 3 1 \\ } ] table[header=true, x index=1, y index=2, row sep=\\] { Nr x y Textposition \\ 1 2 2 north \\%0 1 2 2 north \\%1 2 0 1 south \\%2 3 0 0 north \\%3 }; % Beschriftungen =========== \addplot[only marks, visualization depends on={value \thisrowno{3} \as \Anker}, visualization depends on={value \thisrowno{0} \as \punktnummer}, nodes near coords={\punktnummer}, every node near coord/.append style={anchor=\Anker} ] table[header=true, x index=1, y index=2, row sep=\\] { Nr x y Textposition \\ 1 2 2 north \\%0 1 2 2 north \\%1 2 0 1 south \\%2 3 0 0 north \\%3 }; \end{axis} \end{tikzpicture} \end{document} [1]: https://texwelt.de/wissen/upfiles/55555555_208.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 5

18 Sep '18, 17:28

cis's gravatar image

cis
9.5k102460491

pgfplots (patch) / pgfplotstable: Datentabellen aus dem Code auslagern

Für einen patch plot mit (sehr) umfangreichen Tabellen habe ich eine Tabelle Kantenverbindungsdaten und eine Koordinatentabelle; letztere wird zweimal gebraucht, einmal zur Zeichnung der Punkte, einmal zur Beschriftung (`nodes near coords`). Die Tabellen auslagern mit `filecontents` will `pgfplots` nicht haben, sofern `row sep=\\` vorkommt (was hier scheints gebraucht wird...). Also dachte ich an die Verwendung von `\usepackage{pgfplotstable}`, etwa % Geht nicht ========================== \pgfplotstableread[header=true, row sep=\\] { Startpkt Endpkt colordata \\ Nr x y Textposition \\ 1 2 2 north \\%0 1 2 2 north \\%1 2 0 1 south \\%2 3 0 0 north \\%3 }\Koordinatentabelle und dann an den zwei benötigten Stellen nur noch `table[header=true, x index=1, y index=2, row sep=\\] {\Koordinatentabelle}` **Wie muss ich das richtig machen?** [![alt text][1]][1] \documentclass[margin=5mm, tikz]{standalone} \usepackage{pgfplots, pgfplotstable} \usepgfplotslibrary{patchplots} \begin{document} % Geht nicht ========================== %\pgfplotstableread[header=true, row sep=\\] { %Startpkt Endpkt colordata \\ %Nr x y Textposition \\ %1 2 2 north \\%0 %1 2 2 north \\%1 %2 0 1 south \\%2 %3 0 0 north \\%3 %}\Koordinatentabelle % %\pgfplotstableread[header=true, row sep=\\] { %Startpkt Endpkt colordata \\ %1 1 \\ %2 1 \\ %3 1 \\ %}\Kantentabelle % =========================== \begin{tikzpicture} \begin{axis}[hide axis] % Koordinaten und Kantenverbindungen =========== \addplot+[ table/row sep=\\, % Muss wohl so sein!? patch, % Plot-Typ patch type=polygon, vertex count=2, % damit nur Kanten, keine Flächen, gezeichnet werden patch table with point meta={% Startpkt Endpkt colordata \\ 1 1 \\ 2 1 \\ 3 1 \\ } ] table[header=true, x index=1, y index=2, row sep=\\] { Nr x y Textposition \\ 1 2 2 north \\%0 1 2 2 north \\%1 2 0 1 south \\%2 3 0 0 north \\%3 }; % Beschriftungen =========== \addplot[only marks, visualization depends on={value \thisrowno{3} \as \Anker}, visualization depends on={value \thisrowno{0} \as \punktnummer}, nodes near coords={\punktnummer}, every node near coord/.append style={anchor=\Anker} ] table[header=true, x index=1, y index=2, row sep=\\] { Nr x y Textposition \\ 1 2 2 north \\%0 1 2 2 north \\%1 2 0 1 south \\%2 3 0 0 north \\%3 }; \end{axis} \end{tikzpicture} \end{document} [1]: https://texwelt.de/wissen/upfiles/55555555_208.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 4

18 Sep '18, 16:35

cis's gravatar image

cis
9.5k102460491

Klicke auf Einblenden/Ausblenden von Überarbeitungen 3

18 Sep '18, 16:34

cis's gravatar image

cis
9.5k102460491

Klicke auf Einblenden/Ausblenden von Überarbeitungen 2

18 Sep '18, 16:32

cis's gravatar image

cis
9.5k102460491

Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

18 Sep '18, 16:32

cis's gravatar image

cis
9.5k102460491

Willkommen, erstes Mal hier? Schau mal unter FAQ!

×