为什么取消注释 ymin 时会更改图形?

为什么取消注释 ymin 时会更改图形?

为什么取消注释行“ymin = 0, ymax = 4”时图形会改变?

PD:左图是注释行“ymin = 0, ymax = 4, ”,右图是取消注释行“ymin = 0, ymax = 4, ”。

在此处输入图片描述

\begin{tikzpicture}[scale=1.2]

    \begin{axis}[
%       xmin = 0, xmax = 4,
%       ymin = 0, ymax = 4,
        yticklabel style = {/pgf/number format/.cd,precision=1,fixed},
        axis lines = middle,
        grid = major,
        grid style = {dashed, line width=.1pt, draw=gray!30},
        legend pos = outer north east
    ]

    \addplot[
        domain = 0:2*pi,
        samples = 1000,
        no marks,
        color=blue
    ]
        {sin(deg(x))+2};

    \legend{$\sin(x)$}  

    \end{axis}
\end{tikzpicture}

相关内容