After struggling with Algorithm programming assignmnet finally found sometime to write about a useful linux utility called GNUPLOT .
This piece of software enables you to draw different types of graphs . Got to learn about this when i was expected to plot the running time of different algorithms.
This software has predefined functions to draw various types of curves .Inaddition to it lets you plot graphs for a given values
To start gnuplot type gnuplot in shell type gnuplot. After the shell displays
gnuplot > type in the following options which are optional .
To Create a Title for the Graph : set title ” title name”
To put a label on X axis : set xlabel “xlabel name”
To put a label on Y axis : set ylabel :ylabel name”
To enable GNUPLOT automatically set range : autoscale
To a put a label at a particular point : set label “label name” at x,y
To plot using log axes : set logscale
To plot using log axes on y axis : set logscale y
After setting this , to plot the graph
Rather than giving the syntax i will give u can example which will be more clear
plot “mergesort.dat” using 1:2 title “MergeSort” with line,”selection.dat” using 1:2 title “Selection Sort” with line
mergesort.dat –> is the file which contains the values to plot
1:2 –> take first column on x axis and second column on y axis
title “MergeSort” –> The curve has the label MergeSort
with line –> The after points are plotted to join them by line include this phrase
Contents of mergesort.dat
Contents of selection.dat
All steps couple together
gnuplot > set xlabel “number of items”
gnuplot > set ylabel “seconds”
gnuplot > title “MergeSort vs Selection Sort”
gnuplot > plot “mergesort.dat” using 1:2 title “MergeSort” with line,”selection.dat” using 1:2 title “Selection Sort” with line
The following will display the below graph
This was a very short tutorial displaying one of its functionality . For advanced tutorial just Gooooogle for it!!!!!!!