Gplot Example


Sometimes the simplest things can be remarkably difficult to get done. That was my reaction when I first tried to make a few simple plots. I knew about gnuplot, but it took way too long to make my first useful plot.

Perhaps the most frustrating task was trying to do something as simple (to me) as "plot this data with a blue line" or maybe the dauntingly (:-) complex "plot this data with a blue line using triangles for the data points". Eventually, I figured out one answer was this fragment:

set style line 10 lt 3 lw 1 pt 8 ps 0.55 plot '' with linespoints linestyle 10

Alright, I'm fed up! No more trying to figure out 'lt 3' versus 'lt 5' and 'pt 3' versus 'pt 22'! I just want a simple command I can understand that does what I want: -color red -point triangle

Sure can't handle the five or ten million complexities that gnuplot can -- but I don't care. All I want is a way to plot some simple columnar data and get a graphic or Postscript file of it and I don't want to spend very many seconds figuring it out. If this is what you want too, is for you too.

GPlot is available at SourceForge.

The latest version of GPlot is 1.11 and requires at least gnuplot 4.4. Every year or two the GNUPLOT folks change the syntax for some command or make some other change that is incompatible with an older release. GPLOT doesn't use very many GNUPLOT commands, but nonetheless, every few years, GPLOT breaks. Eventually I catch up, but it means the latest version of GPLOT might not work with your older GNUPLOT. The answer is to get an older GPLOT. Sorry :-(


Gplot is a simple Perl script. It accepts a large set of options to generate a single plot of one or more sets of data (overlaid as necessary). The X and Y axis will be scaled automatically.

The options are provide in two categories. Most options apply to the entire plot (e.g. title) whereas a smaller set can be entered multiple times so that certain values can be set for each plot (e.g. color for each plot). This may require careful reading of the options listed below.

Additional information on using gnuplot is available at these locations (among many others):


The following examples will give you an idea of what Gplot can do. Take a look at the man page for Gplot for the complete set of options. In addition, here is the output of the regression test and will give you examples of many options. Here are examples of the more common uses.

  # plot data in ''. Show as X window

  # plot 2 sets of data.  Show as X window

  # plot data in ''. Create a Postscript file /tmp/ -type ps

  # plot data in ''. Create a Postscript file -type ps -outfile

  # plot data in ''. Annotate it a little -title "This is my data"  -ylabel "Vertical Axis" \
    -xlabel "Horizontal Axis"

  # plot 3 sets of data, specify colors and points -color green -point uptriangle \
           -color blue  -point box \
           -color green -point circle

  # 4 plots in a 2x2 matrix -mplot 2x2 -title Matrix_MultiPlot -using 1 \
           -using 1:2

That should do it. The only file needed is the Perl script, Copy that somewhere in your path and you should be good to go (assuming you have gnuplot installed).

One last surpise - not all output formats (X window, Postscript etc.) generate something that looks exactly the same. I test with '-type xwin' (the default), but the font and annotation stuff seldom looks like the final output for something like '-type ps'. That's the way life is with gnuplot - don't let it throw you.

Direct questions to: Terry Gliedt (Include 'GPlot' in the subject line so my SPAM filter lets your message through.)

This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. See