1

Based on this question, I defined my own arrow style in TikZ and expected it to work in pgfplots:

\documentclass{standalone}

\usepackage{pgfplots}
\usetikzlibrary{arrows.meta}
\pgfplotsset{compat=newest}

\tikzset{myarrow/.style={>={Computer Modern Rightarrow[round]}}}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    axis lines = middle,
    %axis line style={-Computer Modern Rightarrow[round]}, % works
    axis line style={myarrow} % does not work
    ]

    \addplot {x^2};
  \end{axis}
\end{tikzpicture}
\end{document}

When using the myarrow style, I obtain the default arrowhead:

enter image description here

And when I do not use the myarrow style but instead define the arrowhead directly, I get:

enter image description here

What am I doing wrong?

1 Answer 1

2

You should type \tikzset{myarrow/.style={-Computer Modern Rightarrow[round]}} instead of \tikzset{myarrow/.style={>={Computer Modern Rightarrow[round]}}}.

\documentclass[border=5mm]{standalone}

\usepackage{pgfplots}
\usetikzlibrary{arrows.meta}
\pgfplotsset{compat=newest}

\tikzset{myarrow/.style={-Computer Modern Rightarrow[round]}} %<--- edit

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    axis lines = middle,
    axis line style={myarrow} % does work now
    ]

    \addplot {x^2};
  \end{axis}
\end{tikzpicture}
\end{document}

pgf plot custom arrow

1

You must log in to answer this question.

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