Since I updated to TexLive2012 yesterday, I can't get ant colored markers in my legend. Where as first I could put the following in the \addlegendentry
options, it now won't work. [{draw=blue,fill=blue!30!white}]
Now it will make a box around my text with the color described. Do I create the legend in a wrong way or is something else going wrong?
This is the code I'm using:
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[title=\textit{ D - $VMG_{up}$}, xlabel=\textit{$VMG_{up}$ [kn]}, ylabel=\textit{D [m]}, legend style={cells={anchor=west},legend pos=outer north east},minor tick num=1]
\addplot[scatter,only marks, mark=*,mark size=1.5,scatter/use mapped color=
{draw=blue,fill=blue!30!white}]coordinates{
(1.9, 5.4)
(2.1, 5.75)
(2.5, 6.14)
(1.95, 5.6)
(2, 5.28)
(2.1, 5.4)
(1.9, 4.89)
(2.19, 4.94)
(2.36, 5.3)
};
\addlegendentry{$C_n$}
\end{axis}
\end{tikzpicture}
\end{document}
I've only put in a few coordinates. Normally I'm importing them from a .dat
file.
Also I am not an experienced user, so it may be just a silly question.
Best Answer
I found the commit which caused the regression. However, I have the vague impression that the current behavior is the one which matches the documentation (which claims that options after
\addlegendentry[...]
apply to the TEXT, not to the image). In other words: it might have been a bug that it affected the image at all...I will think about it.
In the meantime, I think that you would benefit from the following course of action:
do not use
scatter
plots if all your plot marks look the same. Thescatter
plot is a special "Scatter plot", namely one in which each mark has its individual look (like a color). Theonly marks
style is completely sufficient for your needs.use
mark options={draw=blue,fill=blue!30!white}
instead ofscatter/use mapped color
. Themark options
are applied anyway, and they will be communicated to legend automatically.