Nidish Narayanaa
Nidish Narayanaa

Reputation: 350

GIF term animation in gnuplot with multiplot

I came across the gif terminal in gnuplot. I read that it keeps track of each plot command until the second set out command is encountered. Recently, the need for an animated multiplot came up - is there any way of achieving this with the gif terminal? What I need essentially is a matrix of three plots, each one animated, in some grid I can specify.

Upvotes: 0

Views: 4175

Answers (1)

maij
maij

Reputation: 4218

In a normal single plot environment each plot command creates a new frame. In a multiplot environment each set multiplot - unset multiplot pair creates a new frame which can contain several plot commands like this example:

set terminal gif animate delay 100
set output "multiplot_animated.gif"

n = 50
dphi = 2*pi/n

do for [i=0:(n-1)] {
   phi = i*dphi
   set multiplot layout 2,1
      plot sin(x+phi)
      plot cos(x+phi)
   unset multiplot
}

This is the result. Skip the delay 100 (or change the number) to change the animation speed.

animated multiplot

Upvotes: 4

Related Questions