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少なくともを設定する必要があります。 の値を設定しないとが使用されます。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)};

代わりに 2 番目の\drawコマンドを使用します。

関連情報