鏡像X軸-pgfplot

鏡像X軸-pgfplot

我必須繪製滯後數據。而不是把它放在一個單獨的情節中。我想將它放在兩個圖中,但我希望第二個圖的 X 軸是第一個圖的 X 軸的鏡像。我怎樣才能在 pgfplot 中做到這一點?

見圖說明 在此輸入影像描述

答案1

例如,您可以用於x post scale=-1第二個軸。若要消除它們之間的任何間隙,請將第二個軸的位置設為south east第一個軸的錨點,並將其錨點設為south westx axis line style={-}添加 axis lines/axis x line將刪除箭頭。

要將 x 標籤放置在中間,最簡單的方法是在環境\node後面加上一個 x 標籤axis,放置在south 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}

在此輸入影像描述

相關內容