
과거에 잘 작동했던 그래프가 있었는데 갑자기 모든 것이 y축 하단의 작은 점으로 조정되어 있다는 것을 알았습니다. 변경된 사항이 있는지 확실하지 않으며 문제를 찾을 수 없습니다.
\begin{tikzpicture}
\begin{axis}[
axis lines = middle, %% instead of above two lines this one is enough
scaled ticks=false,
axis equal,
scale=0.5,
y=1cm,
x=3cm,
grid=none,
xmax=2.5,xmin=-0.01,
ymin=-1,ymax=5.2,
xlabel=$x$,ylabel=$y$,
xtick={0,0.5,1,1.5,2},
ytick={-1,0,1,2,3,4},
ylabel = $U(r)$,
xlabel = $r(r_M)$,
]
\draw[red, thick] (0, 5)--(0, 0)--(2.5, 0);
\draw[domain=0.84:2.5,smooth,variable=\x,blue, thick] plot ({\x},{0.1*\x^(-12)-0.1*\x^(-6)});
\end{axis}
\end{tikzpicture}
답변1
pgfplots
버전 1.11 부터 axis cs
기본 좌표계입니다. 하지만 적어도 패키지를 로드한 후 즉시 1.11
설정 해야 합니다 . 값을 설정하지 않으면 then 이 사용됩니다.compat
pgfplots
compat
pre 1.3
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}% comment this to see the issue
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines = middle, %% instead of above two lines this one is enough
scaled ticks=false,
axis equal,
scale=0.5,
y=1cm,
x=3cm,
grid=none,
xmax=2.5,xmin=-0.01,
ymin=-1,ymax=5.2,
xlabel=$x$,ylabel=$y$,
xtick={0,0.5,1,1.5,2},
ytick={-1,0,1,2,3,4},
ylabel = $U(r)$,
xlabel = $r(r_M)$,
]
\draw[red, thick] (0, 5)--(0, 0)--(2.5, 0);
\draw[domain=0.84:2.5,smooth,variable=\x,blue, thick] plot ({\x},{0.1*\x^(-12)-0.1*\x^(-6)});
\end{axis}
\end{tikzpicture}
\end{document}
하지만 나는 사용할 것이다
\plot[domain=0.84:2.5,blue, thick] {0.1*x^(-12)-0.1*x^(-6)};
대신 두 번째 \draw
명령입니다.