I would like to reference some plot lines in text/captions. It is possible by defining a label for the plot in the corresponding axis environment. However, I'm using externalization and only want to distribute the PDF files (not the tikzpicture files), but still want to reference plot lines in the text. How to separately add labels for the plot line without having to include the whole tikzpicture?
As a workaround, I include dummy plots and label them, but it results in appearing a dot in the document. Any way to make this tikzpicture hidden and taking zero space would also be useful.
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
This is how I reference to \ref{hwplot1} and \ref{hwplot2}. But the following 'tikzpicture' results in ploting a dot
%%% This is neccessary for drawing plot lines in the text
\begin{tikzpicture}
\begin{axis}[hide axis]
\addplot [
color=red,
solid,
line width=0.9pt,
forget plot
]
(0,0);\label{hwplot1}
\addplot [
color=black,
dashed,
line width=1.2pt,
forget plot
]
(0,0);\label{hwplot2}
\end{axis}
\end{tikzpicture}%
\end{document}


