# pgfplots: x dir = reverse --> Problem with x-label (xlabel) placement

## 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:
\end{axis}
\end{tikzpicture}

\end{document}


## Related

Positioning of Pgfplot axis labels

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:
\end{axis}
\end{tikzpicture}

\end{document}


Result:

Source: PGFPLOTS manual section 4.9.9 Axis Lines.

• Thanks a lot! And especially thanks for mentioning the source. – Dr. Manuel Kuehner Feb 7 at 19:27
• Sorry for the late reply, I am in a difficult time zone. – Dr. Manuel Kuehner Feb 7 at 19:28
• *"difficult" should be "different" :) – Dr. Manuel Kuehner Feb 8 at 3:37
• @Dr.ManuelKuehner I was wondering indeed what a difficult time zone could be :) – Marijn Feb 8 at 7:32