
我需要幫助在單一圖上繪製不同的線
例如,我有
a = 1;
θ = [0 30 60 90];
d1 = a.*sind(theta);
d2 = a.*cosd(theta);
繪圖(d1,d2)
但是,我還想在同一張圖上為 a=2,3,4 繪製單獨的線。
答案1
您正在尋找類似的東西嗎?
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=0:90,no markers]
\pgfplotsinvokeforeach{1,2,3,4}{
\addplot ({#1*sin(x)},{#1*cos(x)});
\addlegendentry{$a = #1$};
}
\end{axis}
\end{tikzpicture}
\end{document}