如何使用 foreach 自动加载表格图、添加随机颜色和图例?

如何使用 foreach 自动加载表格图、添加随机颜色和图例?
\begin{tikzpicture}
\begin{axis}[scaled x ticks={real:1e3},xtick scale label code/.code={$\cdot 10^3$},
axis lines=left,
%xticklabel={$\pgfmathprintnumber{\tick}\lambda$}, pone lambda al lado del tikz
%xticklabel style={rotate=45,anchor=east},%rota los tixks
%/pgf/number format/.cd,1000 sep={},%cambia la separacion de miles
%title=Pupila 1,
xlabel={$\frac{1}{F}$},
ylabel={$y$},
%ymin=0, ymax=3,
minor y tick num=1,
%enlargelimits=true
enlarge x limits=upper,
enlarge y limits=upper,
%cycle list name=exotic,
%patch,%punteadas
%fill=orange!75
%fill=-red!75!green
%stack plots=y,
%stack dir=minus,
%cycle list name=list3
%legend entries={$\sigma=0.0 5$,$\sigma=0.1$,$\sigma=0.25$,$\sigma=0.5$,$\sigma=1$,$\sigma=2.5$,$\sigma=5$,$\sigma=10$,$\sigma=25$},
legend cell align=left,
legend pos=outer north east]
%\addplot[blue] table {Libro1.txt};
\foreach\c in {0,0.005,0.015625,0.03125,0.0625,0.125,0.25,0.5,1,2,5,10,20,50,100,200,500,1000,2000,4000} {
\addplot[red,very thick] table [col sep=tab,trim cells=true,y=\c]{myFile.txt};
}
%\addplot[Chartreuse3,very thick] table [col sep=tab,trim cells=true,y=5] {myFile.txt} ;
%\addplot[DarkGoldenrod2,very thick] table [col sep=tab,trim cells=true,y=4000] {myFile.txt};
%\addplot[IndianRed1,very thick] table [col sep=tab,trim cells=true,y=c11] {myFile.txt};
%\addplot[MediumPurple3,very thick] table [col sep=tab,trim cells=true,y=c11] {myFile.txt};
%\addplot[magenta,very thick] table [col sep=tab,trim cells=true,y=c13] {myFile.txt};
%\addplot[Snow4,very thick] table [col sep=tab,trim cells=true,y=c15] {myFile.txt};
%\addplot[ForestGreen,very thick] table [col sep=tab,trim cells=true,y=c17] {myFile.txt};
%\addplot[black,very thick] table [col sep=tab,trim cells=true,y=c19] {myFile.txt};
    %\draw[red,ultra thick,densely dashed] (axis cs:6,0) -- (axis cs:6,1);
\end{axis}
\end{tikzpicture}

相关内容