答案1
欢迎!您可以创建自己的cycle list
交替线条样式,并用于\pgfplotsinvokeforeach
循环遍历图表以获得
\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}
\pgfplotscreateplotcyclelist{pft}{
cyan,solid\\
red,dashed\\
}
\begin{axis}[xmin=-7,xmax=7,ymin=-25,ymax=25,
xtick={-6,-4,...,6},ytick={-20,0,20},grid=major,
ylabel={$y$},xlabel={$x$},
cycle list name=pft]
\pgfplotsinvokeforeach{-2.4,-2.1,...,2.4}{
\addplot+[no marks,domain=-7:7,smooth]{#1*x*x};}
\end{axis}
\end{tikzpicture}
\end{document}