Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to reference a plot in the legend. The problem is, that the little legend image from the blue plot is shown distorted in the legend.

Here a minimal example:

\documentclass{minimal}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}
    \addplot[color=red] coordinates {(1, 1) (2, 200)};
    \addlegendentry{plot 1 (\ref{pgfplots:plot2} xy added)}

    \addplot[color=blue, mark=x, forget plot] coordinates {(2, 200) (2.5, 100) (3, 50)};
    \label{pgfplots:plot2}

    \addplot[color=red, forget plot] coordinates {(3, 50) (4, 100)};
  \end{axis}
\end{tikzpicture}\\
Here the legend image \ref{pgfplots:plot2} is displayed correctly.
\end{document}

How is it possible to fix this? Thanks for your time.

share|improve this question
    
I suspect this is a bug in pgfplots: consider reporting it via the e-mail address given in the package documentation. –  Joseph Wright Jul 21 '12 at 6:31
add comment

1 Answer

It is a bug in pgfplots 1.5.1 (the current stable).

I will take care of it (the \tikzifinpicture macro shipped with tikz needs to be fixed).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.