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

25 Aug '16, 10:09

Henri's gravatar image

Henri
15.7k133943

Ein sehr ähnliches Beispiel gibt es in der Dokumentation, siehe [`visualization depends on`](http://texdoc.net/texmf-dist/doc/latex/pgfplots/pgfplots.pdf#pgfp./pgfplots/visualization%3Adepends%3Aon). \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[enlargelimits=0.2,colorbar] \addplot[ scatter,mark=square*,only marks, point meta=\thisrow{myvalue}, visualization depends on= {\thisrow{myvalue} \as \perpointmarksize}, scatter/@pre marker code/.append style= {/tikz/mark size=\perpointmarksize} ] table { x y myvalue 0.5 1 0.25 0.2 2 3 0.7 3 0.75 0.35 4 0.125 0.65 5 2 }; \end{axis} \end{tikzpicture} \end{document} ![alt text][1] --- Wenn das nicht gemeint war, dann kann man leicht einen eigenen Plotmarker definieren. Man muss bei den Größen immer Einheiten mit angeben, ansonsten wird `pt` gewählt. \documentclass{article} \usepackage{pgfplots} \newdimen\pgfplotmarkwidth \newdimen\pgfplotmarkheight \def\pgfsetplotmarkwidth#1{\pgfmathsetlength\pgfplotmarkwidth{#1}} \def\pgfsetplotmarkheight#1{\pgfmathsetlength\pgfplotmarkheight{#1}} \tikzoption{mark width}{\pgfsetplotmarkwidth{#1}} \tikzoption{mark height}{\pgfsetplotmarkheight{#1}} \pgfdeclareplotmark{rectangle}{% \pgfpathrectangle {\pgfqpoint{-.5\pgfplotmarkwidth}{-.5\pgfplotmarkheight}}% {\pgfqpoint{\pgfplotmarkwidth}{\pgfplotmarkheight}}% \pgfusepathqfillstroke } \begin{document} \begin{tikzpicture} \begin{axis}[enlargelimits=0.2,colorbar] \addplot[ scatter,mark=rectangle,only marks, mark width=0.1cm,mark height=0.12cm, point meta=\thisrow{myvalue} ] table { x y myvalue 0.5 1 0.25 0.2 2 3 0.7 3 0.75 0.35 4 0.125 0.65 5 2 }; \end{axis} \end{tikzpicture} \end{document} ![alt text][2] [1]: http://texwelt.de/wissen/upfiles/test_211.pnghttp://texwelt.de/wissen/upfiles/test_211.png [2]: http://texwelt.de/wissen/upfiles/test_212.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

25 Aug '16, 10:06

Henri's gravatar image

Henri
15.7k133943

Ein sehr ähnliches Beispiel gibt es in der Dokumentation, siehe [`visualization depends on`](http://texdoc.net/texmf-dist/doc/latex/pgfplots/pgfplots.pdf#pgfp./pgfplots/visualization%3Adepends%3Aon). \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[enlargelimits=0.2,colorbar] \addplot[ scatter,mark=square*,only marks, point meta=\thisrow{myvalue}, visualization depends on= {\thisrow{myvalue} \as \perpointmarksize}, scatter/@pre marker code/.append style= {/tikz/mark size=\perpointmarksize} ] table { x y myvalue 0.5 1 0.25 0.2 2 3 0.7 3 0.75 0.35 4 0.125 0.65 5 2 }; \end{axis} \end{tikzpicture} \end{document} ![alt text][1] [1]: http://texwelt.de/wissen/upfiles/test_211.png