GNUPLOT (making animation)

GNUPLOT is very powerful set of programs for making graphs. Here, we see how can we use it for making animation and saving it in gif format.

#!/bin/bash
rm -f gnuplot.rot
###Making input file for the gnuplot
for ((z=0; z<=360; z=z+5)) #for varying the longitude
do
cat >> gnuplot.rot <<!
zrot=$z
zview(zrot)=zrot
set view xview(xrot), zview(zrot), 2, 1
set size square
set view xview(xrot), zview(zrot), 2, 1
set size square
splot cos(u)*cos(v),cos(u)*sin(v),sin(u) notitle with lines lt 5, \
      'world10.dat' notitle with lines lt 3 lw 1     
!
done

echo "Now Plotting"


gnuplot<<!
set term gif transparent nocrop enhanced animate delay 20 loop 0 nooptimize #setting the terminal size 600,600 background rgb 'white' font "verdana,12"
set output "globe.gif" #setting the output name
unset title #notitle
unset key #no key
unset xtics #no x axis ticks
unset ytics #no y axis ticks
set border 0 #no border
set hidden3d nooffset #hidden line removal for surface plotting
set parametric
set angles degrees
set samples 128,128 #no of points
set isosamples 13,13
set mapping spherical
set dummy u,v
set urange [ -90.0000 : 90.0000 ] noreverse nowriteback
set vrange [ 0.00000 : 360.000 ] noreverse nowriteback
set style data line
xrot=90
xview(xrot)=xrot
load "gnuplot.rot"
!

globe.gif

Data File: world10.dat

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: