pgfplots: Verschieben des Xlabels in die Mitte des Diagramms

pgfplots: Verschieben des Xlabels in die Mitte des Diagramms

Was muss ich einstellen, um das Xlabel genau in der Mitte des Diagramms zu bekommen?

Bildbeschreibung hier eingeben

\documentclass[]{book}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[font=\footnotesize]
\begin{axis}[
xlabel={This is the x-label},
xlabel style={fill=yellow,
at={([shift={(xticklabel* cs:0.5)}]yticklabel* cs:0.5)},
},
]
\end{axis}
\end{tikzpicture}
\end{document}

Antwort1

Durch xlabel style(korrekte) Definition der Position des Etiketts:

\begin{document}
    \begin{tikzpicture}[font=\footnotesize]
\begin{axis}[
xlabel={This is the x-label},
xlabel style={fill=yellow,
               at={(0.5,0.5)}, anchor=center}, % <---
]
\end{axis}
    \end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen