1

Issue

  • I use x dir = reverse to reverse the direction of the x-axis (arrow points to the left).
  • Is there an easy way to also move the x label to the "correct" position (mirrored regarding the y-axis compared to the "normal" case)?

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

% http://pgfplots.sourceforge.net/gallery.html \begin{tikzpicture} \begin{axis}[ axis lines = middle, xlabel = {x label}, ylabel = {y label}, x dir = reverse, % <-- Important ] % use TeX as calculator: \addplot {x^2 - x +4}; \end{axis} \end{tikzpicture}

\end{document}

enter image description here

Related

Positioning of Pgfplot axis labels

1 Answers1

2

You can set the position with xlabel style={at={}}. The left of the plot is current axis.left of origin.

MWE:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

% http://pgfplots.sourceforge.net/gallery.html \begin{tikzpicture} \begin{axis}[ axis lines = middle, xlabel = {x label}, xlabel style={at={(current axis.left of origin)},anchor=south west}, ylabel = {y label}, x dir = reverse, % <-- Important ] % use TeX as calculator: \addplot {x^2 - x +4}; \end{axis} \end{tikzpicture}

\end{document}

Result:

enter image description here

Source: PGFPLOTS manual section 4.9.9 Axis Lines.

Marijn
  • 37,699