X軸をミラーリング-pgfplot

X軸をミラーリング-pgfplot

ヒステリシス データをプロットする必要があります。 1 つのプロットに配置するのではなく、2 つのプロットに配置したいのですが、2 番目のプロットの X 軸を最初のプロットの X 軸の鏡像にしたいのです。 pgfplot でこれを行うにはどうすればよいですか?

詳細は図を参照 ここに画像の説明を入力してください

答え1

たとえば、x post scale=-12番目の軸に を使用できます。2つの軸の間のギャップを削除するには、2番目の軸の位置をsouth east最初の軸のアンカーに設定し、そのアンカーを に設定しますsouth westx axis line style={-}追加されました axis lines/ はaxis x line矢印の先を削除します。

中央に x ラベルを配置するには、環境の\node後に を追加しaxissouth east最初の軸の角の下に配置するのが最も簡単です。

\documentclass[border=4mm]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\pgfplotsset{every outer x axis line/.style={-}}
\begin{axis}[
  name=ax1,
  axis lines=left,
  x axis line style={-}]
\addplot{x};
\end{axis}
\begin{axis}[
  axis x line=bottom,
  axis y line=right,
  x axis line style={-},
  x post scale=-1,
  at={(ax1.south east)},
  anchor=south west]
\addplot{x};
\end{axis}

\node [below=1cm] at (ax1.south east) {Common xlabel};
\end{tikzpicture}
\end{document}

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

関連情報