Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Functions of two variables evolving in time with gnuplot

  1. Jun 25, 2017 #1
    Hi there. I am making some numerical tests, and printing the results in a data file. The data file contains the Cartesian coordinates, and the function to be plotted at the x,y point for each time t in columns: x,y,f(x,y). I could add a fourth column for the time step, or equally print each time step in different files. I have already a script for gnuplot to plot in contour diagrams. I would like to extend this script in such a way that it prints a .png file for each time. This could be done just by using a single data file with x,y,f(x,y),t information in columns, or using different data files with the x,y,f(x,y) information for each time as well. The idea is to use a loop file, but I don't know how to do this.

    Does anyone here knows how to do this in gnuplot?

    I've tried to call to this file:

    t = t + 0.1
    outfile = sprintf('animation/analytical1%02.0f.png',10*t)

    set output outfile

    set terminal png size 1024,768

    splot ('fort.1%02.0f',10*t)

    if(t<end_time) reread;

    From this I get all the png files, but it looks like it is not reading the information.

    Originally, for a single time I had:

    splot 'file.dat' using 1:2:3

    But now if I put "using 1:2:3" the script gives me an error.

    Edit: Ok. It seems now it works, I added the line:

    infile = sprintf('fort.1%02.0f',10*t)

    splot infile using 1:2:3

    Edit: Fixed. Now it works.
    Last edited: Jun 25, 2017
  2. jcsd
  3. Jun 30, 2017 #2
    Thanks for the thread! This is an automated courtesy bump. Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post? The more details the better.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted