Looping with variable filenames in gnuplot

  • Peter

    Peter - 2005-10-28


    I want to have a loop in gnuplot where I plot the contents of a file named "file_x" and at every stage of the loop the x is incremented by 1 and loops until a certain value for x is reached. This way I can have an animated plot from x files.
    How do I do this?


    • Andrew Caird

      Andrew Caird - 2005-10-28


      I don't think gnuplot has any way of doing this, but you could script it outside of gnuplot and combine the outputs.

      However, there is a patch in CVS from Ethan Merritt that does this for you; see http://www.bmsc.washington.edu/people/merritt/gnuplot/ for an example.

      Hope this helps.

      • Angelo R. Rossi

        Angelo R. Rossi - 2005-10-29


        In reading the message below, I went to the website below


        and saw several patches to gnuplot that would be great to have ... including a new driver for .doc files.  I really dislike .doc files and usually use latex/gnuplot.  But this new gnuplot driver would help out when I must use a .doc file.

        Anyway, I followed the directions very carefully on how to obtain the cvs version of gnuplot which already contains the updates, but I can't get the new source version.

        The cvs login hangs.  Can someone please help out with this.  Are the directions out of date?

        Thanks for your help with this.

        Kind regards,


    • Peter

      Peter - 2005-10-28

      Hey Andrew,

      Thank a lot. If I manage to install the patch I can do what I want. The only problem is that I'm running gnuplot on MacOSX and I've installed gnuplot through Fink, so no idea how to install additional patches. What's the other way you suggested using outside scripting?



Log in to post a comment.