tikz 그래프가 점으로 스케일링됨

tikz 그래프가 점으로 스케일링됨

과거에 잘 작동했던 그래프가 있었는데 갑자기 모든 것이 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 이 사용됩니다.compatpgfplotscompatpre 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명령입니다.

관련 정보