Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have quite a few tables generated which I want to plot in the same TikZ figure (using pgfplots). I am currently trying to use a foreach loop to plot them all, but it is only plotting the last figure.

\begin{figure}
\begin{tikzpicture}
\begin{axis}[axis lines=middle,legend pos=north west,
    xlabel=$x$,
    ylabel=$y$,
    legend style={draw=none}]
    \def \N {14}
    \foreach \i in {1,...,\N} {
        \addplot[smooth,magenta] plot[]file{tablerev/airyratio\N.dat};
    }
\end{axis}
\end{tikzpicture}
\end{figure}

I'm not sure what is causing this behavior. Apparently using the \N works as part of a filename, and if I plot them separately they will plot, so why is it not showing all 14 plots?

share|improve this question

closed as too localized by Gonzalo Medina, cmhughes, Kurt, Werner, Jake Nov 24 '12 at 6:02

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
should the \N in the \addplot be a \i? –  cyberSingularity Nov 24 '12 at 1:58
    
...yes, oops...x_x Now how to close this question? –  Hanmyo Nov 24 '12 at 2:16
    
I believe there should be a close link near the share, edit etc links at the bottom of your post. I can't help out with this as its above my reputation grade! –  cyberSingularity Nov 24 '12 at 2:22
    
glad you got it fixed :) I'll flag it for a moderator, and will vote to close (you need \geq 3000 rep to vote) –  cmhughes Nov 24 '12 at 2:32

Browse other questions tagged or ask your own question.