我正在尝试绘制一些参数曲线,但总是出现错误“尺寸太大”。有什么方法可以解决这个问题吗?
\begin{tikzpicture}[scale=.2]
\draw[very thin,color=gray,step=.5cm,dashed] (-8,-8) grid (4,4);
\draw[<->, blue] (-8,0) -- (4,0) node[below right] {$x$};
\draw[<->, blue] (0,-8) -- (0,4) node[left] {$y$};
\draw [red, thick, domain=-10:1.1, samples=40]
plot ({\x^3-3*\x}, {3*\x^2-9} );
\end{tikzpicture}
答案1
\documentclass[11pt]{scrartcl}
\usepackage{tkz-fct}
\begin{document}
\begin{tikzpicture}[scale=1.5]
\tkzInit[xmin=-5,xmax=5,xstep=2,ymin=-10,ymax=4,ystep=2]
\tkzGrid[sub]
\tkzAxeX[step=2]
\tkzAxeY[step=2]
\tkzFctPar[samples=400,domain=-pi:pi]{t**3-3*t}{3*t**2-9}
\end{tikzpicture}
\end{document}
答案2
问题出在这条线上
\draw [red, thick, domain=-10:1.1, samples=40]
plot ({\x^3-3*\x}, {3*\x^2-9} );
特别是,你的domain=-10:1.1
太大了。你可以改变它,或者更好的是,使用pgfplots
来完成你的任务,这就是我下面所演示的。
\pgfplotsset
请注意在序言中使用来设置全局设置。
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{every axis/.append style={
axis x line=middle, % put the x axis in the middle
axis y line=middle, % put the y axis in the middle
axis line style={<->,color=blue}, % arrows on the axis
xlabel={$x$}, % default put x on x-axis
ylabel={$y$}, % default put y on y-axis
}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=-8,xmax=4,
ymin=-8,ymax=4,
grid=both,
]
\addplot [domain=-3:3,samples=50]({x^3-3*x},{3*x^2-9});
\end{axis}
\end{tikzpicture}
\end{document}
答案3
使用 PSTricks 只是为了好玩!
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\psset{unit=5mm,plotpoints=1000,algebraic}
\begin{document}
\begin{pspicture}(-20,-12)(21,21)
\psaxes[Dx=5,Dy=5]{->}(0,0)(-20,-12)(20,20)[$x$,0][$y$,90]
\psparametricplot[linecolor=blue,linewidth=2\pslinewidth]{-3}{3}{t^3-3*t|3*t^2-9}
\end{pspicture}
\end{document}