I'm trying to implement a scatter plot that automatically scales the marks according to its absolute values. I don't want to use \pgfplotspointmetatransformed
but rather \pgfplotspointmeta
, as I need to compare it to another plot, though I just can't manage to do so…
Furthermore I tried creating a colormap, that maps from a color range for z > 0, and a different color range for z < 0. So you'd immediately notice whether a value is negative or positive – though I'm kind of confused so set the limits the way, that it changes from red to blue at 0, because I'm already using the meta data for the size…
\pgfplotstableread{
A B C
0 5 -10
0.5 2 0
1 7 5
1.5 11 20
}\mytable
\begin{tikzpicture}
\pgfplotsset{
colormap={test}{[2pt]
rgb255(0pt)=(255, 200, 0);
rgb255(500pt)=(255, 75, 0);
rgb255(502pt)=(0, 100, 255);
rgb255(1000pt)=(0, 255, 255)
}
}
\begin{axis}[
colorbar
]
\addplot[
scatter,
only marks,
scatter src=explicit,
mark=*,
scatter/use mapped color={
draw=mapped color,
fill=mapped color,
},
scatter/@pre marker code/.append style=
{/tikz/mark size={.6pt+abs(\pgfplotspointmetatransformed/200)}}]
table[meta expr=abs(\thisrow{C})] {\mytable};
\end{axis}
\end{tikzpicture}
I'd be happy for hints
Thx
Best Answer
I am not 100% sure if I have understood your question right. Do you mean something like the following?