1

As an annotation to a plot, I want to draw an arrow with an arrowhead at both sides (and some text above it). Normally, this is done via the <-> option. However, if I set the style to -latex, only one end of the arrow has an arrowhead, so the <-> is ignored.

What's the reason for this behavior? How can I make this work? Consider the following MWE:

\documentclass{standalone}

\usepackage[T1]{fontenc}
\renewcommand*\sfdefault{phv}
\renewcommand*{\familydefault}{\sfdefault}
\usepackage{arevmath}

\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}
\usepackage{pgfplotstable}

\begin{document}
\begin{tikzpicture}
\begin{axis}[%
width=192.0mm,
height=108.0mm,
scale only axis,
xmin=0,
xmax=100,
xlabel={Zeit $t$},
ymin=0,
ymax=100,
ylabel={Leistung $P$},
name=plot1,
legend style={at={(axis cs:1,95)},anchor=west,draw=black,fill=white,legend cell align=left}
]
\addplot [color=blue,solid]
  table[row sep=crcr]{%
0   0\\
100 100\\
};
\addlegendentry{Plot (1)};

\draw[<->, line width=0.5mm] (50,0) -- (50,50);
%% Should also be double-sided, but isn't
\path [<->, line width=0.5mm, -latex] (95, 0) edge node[sloped, above right, text width=20mm, pos=0.05]
{$y$-Wert bei\\ $x = 95$} (95, 95);
\end{axis}
\end{tikzpicture}
\end{document}

The arrow on the right should also be double sided as the arrow in the center. arrowDouble

3
  • 5
    -latex overwrites <->. If you want to change the arrow, replace -latex by >=latex or delete -latex and replace <-> with latex-latex.
    – Ignasi
    Mar 22, 2017 at 12:20
  • Thanks, works perfectly. Looks like the correct answer, if you post it as such, I can mark the question as solved.
    – winkmal
    Mar 22, 2017 at 14:33
  • Done! I hope it's clear enough.
    – Ignasi
    Mar 22, 2017 at 16:01

1 Answer 1

2

In \path [<->, line width=0.5mm, -latex], -latex overwrites initial <-> setting and the result is a line with an arrow tip only on final coordinate.

If the desired solution is a double arrow line with latex tips you could type

\path [<->, line width=0.5mm, >=latex]

where >=latex just fixes the kind of arrow tip while <-> keeps the double arrow, or

\path [line width=0.5mm, latex-latex]

where latex-latex defines a double arrow with tips of latex type.

If the desired result is a figure with all arrow tips of latex type, you could write \begin{tikzpicture}[>=latex].

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .