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'm creating a custom legend for some pgfplots graph by drawing a node containing a shortstack. Inside the node I'm using \ref{} to insert correct line-styles in front of my text labels.

The problem is that while the lines in the graph are printed with line width=1pt, the lines from \ref are the standard thin size of pgfplots.

This does not happen when using the normal pgfplots legend setup (\addlegendentry), but this is not possible in this graph since the legend either needs to contain extra information or is a common legend for 2 different axis.

So how can I control the line width when using \ref?

share|improve this question
    
Please register your account at Stack Overflow and at TeX Stack Exchange to be able to comment on your question and its answers after the migration, and to accept an answer. –  Paŭlo Ebermann Aug 18 '11 at 13:44
    
Please add a minimal working example (MWE) that illustrates your problem. –  Caramdir Aug 18 '11 at 15:31
add comment

migrated from stackoverflow.com Aug 18 '11 at 13:48

This question came from our site for professional and enthusiast programmers.

1 Answer

Maybe you specified the line width incorrectly. Here's an example that shows that \ref does indeed produce the correct line width:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}


\begin{document}

\centering 
\begin{tikzpicture}
\begin{axis}
\addplot +[line width=2pt] {rnd}; \label{graph1}
\addplot {rnd}; \label{graph2}
\end{axis}
\end{tikzpicture}

\ref{graph1} 2pt line; \qquad \ref{graph2} normal line
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

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