# How to insert a vertical line as legend entry for a vertical graph

by Sral   Last Updated October 09, 2019 15:23 PM

I have two graphes, one horizontal (y1) and one vertical (y2) line. For a better identification in the legend, I want the vertical graph (y2) also to be represented by a vertical line in the legend. In other words: left to y2 should be a vertical dashed line (rotation of 90°), while the y1 legend entry stays as it is.

Is there any way to customize the appearance of the legend entry symbols like that? Thank you very much for your help!

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0,
xmax=5,
ymin=0,
ymax=5,
axis background/.style={fill=white},
legend entries={y1,y2},
]
table[row sep=crcr]{%
0   3\\
5   3\\
};