TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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{axis}[axis lines=middle,legend pos=north west,
    legend style={draw=none}]
    \def \N {14}
    \foreach \i in {1,...,\N} {
        \addplot[smooth,magenta] plot[]file{tablerev/airyratio\N.dat};

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