这是我的代码:
\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\[
\begin{tikzpicture} [scale=1]
\begin{axis}[
axis x line = center,
axis y line = center,
xlabel=$x$,
ylabel=$y$,
xtick={-2.0,-1.0,0.0,1.0,2.0},
xticklabels={$-2$,$-1$,$0$,$1$,$2$},
ytick={-2.0,-1.0,0.0,1.0,2.0},
yticklabels={$-2$,$-1$,$0$,$1$,$2$},
domain=-2:2,
grid=none,
unit vector ratio*=1 1,
enlargelimits = true
]
\foreach \n in {0.5,1,1.5,2,2.5,3}
{
\addplot[
thick,
variable=\t,
domain=-3:3,
samples=200,
color=blue
]
({\t}, {\t^2/(2*\n^2) - \n^2/2});
}
\foreach \m in {0.5,1,1.5,2,2.5,3}
{
\addplot[
thick,
variable=\t,
domain=-3:3,
samples=200,
color=red
]
({\t}, {\m^2/2 - \t^2/(2*\m^2)});
}
\end{axis}
\end{tikzpicture}
\]
以下是我得到的结果:
为什么会这样?我该如何解决?