미러 X 축-pgfplot

미러 X 축-pgfplot

히스테리시스 데이터를 그려야 합니다. 단일 플롯에 넣는 대신. 2개의 플롯에 넣고 싶지만 두 번째 플롯의 X축이 미러 이미지 첫 번째 플롯의 X축이 되도록 하고 싶습니다. pgfplot에서 이 작업을 어떻게 수행할 수 있나요?

설명을 위해 그림을 참조하세요. 여기에 이미지 설명을 입력하세요

답변1

x post scale=-1예를 들어 두 번째 축에 사용할 수 있습니다 . 두 축 사이의 간격을 제거하려면 두 번째 축의 위치를 south east​​첫 번째 축의 앵커로 설정하고 해당 앵커를 로 설정합니다 south west. x 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}

여기에 이미지 설명을 입력하세요

관련 정보