绘制的轴长超过指定值

绘制的轴长超过指定值

下图中的 y 轴比我想要的高度高出约 10 倍。该图的最大高度为 0.5 个单位。我指定 y 轴的高度应为 2 个单位。

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\begin{tikzpicture}
\begin{axis}[width=6in,axis equal image,clip=false,
    axis lines=middle,
    xmin=-2,xmax=2,
    domain=-2:2, samples=201,
    xlabel=$x$,ylabel=$V$,
    ymin=-1,ymax=2,
    restrict y to domain=-2:2,
    enlargelimits={abs=0.5cm},
    axis line style={latex-latex},
    ticklabel style={font=\tiny,fill=white},
    xtick={1},ytick={0.5},
    xlabel style={at={(ticklabel* cs:1)},anchor=north west},
    ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot[samples=501,domain=0:1.73205,blue] {0.25 *(3*x - x^(3))} node[right, pos=0.75,font=\footnotesize]{$y = \frac{3x - x^{3}}{4}$};
\addplot[samples=501,domain=-2:0,blue, dashed] {0.25 *(3*x - x^(3))};
\addplot[samples=501,domain=1.73205:2,blue, dashed] {0.25 *(3*x - x^(3))};
\end{axis}
\end{tikzpicture}


\end{document}

答案1

虽然您没有打印最大值,y=2但在其上添加了 0.5 厘米。因此,您的图已经很大,再添加 5 毫米并不能使其像看起来那么大。

作为示例,我仅修改ymax=1并注释了,ytick={0.5},部分内容。结果是

在此处输入图片描述

相关内容