In PGFPlots, I'd like to set the default axis description location near the arrow for non boxed axes and otherwise keep the existing default of placing the axis description halfway between both ends of the axis. For example, take the following code:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\pgfplotsset{%
every axis x label/.style={%
at={(ticklabel cs:0.95)}, anchor=near ticklabel,
},
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel={$x$},
ylabel={$y$},
axis x line=bottom,
axis y line=left,
]
\addplot[
domain=-2:2,
samples=100,
] {x^2};
\end{axis}
\end{tikzpicture}
\end{document}
which produces:
The every axis x label
sets the axis description position regardless of whether the axis is boxed or non boxed (comment out axis x line
to see this). There's a every non boxed x axis
key, but I believe this is for the axis line, not the description. I wasn't able to find a every non boxed axis x label
key, or something similar. Of course, I could do this on a case-by-case basis (which is what I've been doing), but I'd prefer to make this a default. Is this possible?