그림의 라벨 문제

그림의 라벨 문제

나는 tikz를 처음 사용합니다. 아래 빨간색 상자 부분에 x, y 축 레이블이 표시됩니다. 이제 자동으로 (0,5,10,15,20) 증가합니다. 예상 결과는 (1,2,3,4)와 같습니다. . 다음 코드를 사용하고 있습니다. 이 코드를 어떻게 변경하나요?

\documentclass{standalone}
\usepackage{mathtools}
\usepackage{pgfplots}
\usepackage{siunitx}

\sisetup{per-mode=symbol}
    \begin{document}
  \begin{tikzpicture}
    \begin{axis}[
      xmin=0,xmax=20,
      ymin=0,ymax=20,
      axis y line*=left,
      axis x line*=bottom,
      xlabel={$p_0$ (psi)},
      xlabel near ticks,
      ylabel near ticks
    ]
    \end{axis}
  \end{tikzpicture}
\end{document}

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

답변1

눈금 표시 위치와 각 표시에 대한 레이블을 정의할 수 있습니다.

\documentclass{standalone}
\usepackage{mathtools}
\usepackage{pgfplots}
\usepackage{siunitx}

\sisetup{per-mode=symbol}
    \begin{document}
  \begin{tikzpicture}
    \begin{axis}[
      xmin=0,xmax=20,
      ymin=0,ymax=20,
      axis y line*=left,
      axis x line*=bottom,
      xlabel={$p_0$ (psi)},
      xlabel near ticks,
      ylabel near ticks,
      xtick={0,5,10,15,20},
      xticklabels={0,1,2,3,4},
      ytick={0,5,10,15,20},
      yticklabels={0,1,2,3,4}
    ]
    \end{axis}
  \end{tikzpicture}
\end{document}

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

관련 정보