Monday, April 2, 2012

New version of gnuplot makes iterations easy --- animation as an example

Gnuplot4.6 have been released on 2012.03.08. And some new features have been added. Among them, I think block-structured if/else/while/do is the most useful one. With this new feature, one can easily deal with loop. In this post I will talk about this new feature taking animation as an example. In a previous post, how to create a gif animation using gnuplot have been talked. And it seems a little complex. An extra file is needed. Here with this new feature in gnuplot4.6, the work can be done simply as follows:

set term gif animate
set output "animate.gif"
n=24 #n frames
set xrange [0:4*pi]
set yrange [-1:1]
do for [i=0:n]{
  plot sin(x+i*dt)/(1. + i/12.) w l lw 1.5 title sprintf("t=%i",i)
set output
Animation using new fearute of gnuplot4.6


  1. you meant to say "gnuplot 4.6"?

    1. Thank you for pointing out my mistake! Yes, I means "gnuplot4.6", not "6.4". Now I have correct it.

  2. 现在4.7了,更新的好快

  3. Thanks, it was useful to me in 2017.

  4. IOT Training in Bangalore - Live Online & Classroom
    Iot Training course observes iot as the platform for networking of different devices on the internet and their inter related communication. Iot Training in Bangalore

  5. Gaining Python certifications will validate your skills and advance your career.
    python certification


Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.