pgfplots: 図の中央の xlabel をシフトする

pgfplots: 図の中央の xlabel をシフトする

xlabel を図の真ん中に配置するには、何を設定する必要がありますか?

ここに画像の説明を入力してください

\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}

答え1

ラベルの位置をxlabel style(正しく)定義します。

\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}

ここに画像の説明を入力してください

関連情報