Gnuplot on Windows

Installing Gnuplot

Skip this if you are working on the clusters it is already installed...

On your home desktop, you will need to download from the following site:

Extract the file into "My Documents". Open "My Computer" and find the file wgnuplot. It should be somewhere like:

C:/Documents and Settings/username/My Documents/gnuplot/bin

Now right click on the icon for wgnuplot, select create shortcut, then move the shortcut icon to the desktop. You can now start gnuplot by clicking on the icon on the desktop.

Running Gnuplot

Every time you open gnuplot you will need to change directory to the place where your data files are stored. If you have run the file write code from earlier on this will be in the directory "Data" that you created. Press on ChDir and find the appropriate directory.

In order to issue commands we must type them in at the command line. The menus will give some help on which commands to use. See the online help for more info. There are some useful links and exmaples on the Gnuplot course on my web page.

To plot the file test.csv we must enter:

plot 'test.csv' using 1:3 with line

The plot should appear on screen.

It is much easier to work in gnuplot if we save all the commands that we need to issue into a "plot file". This is simply a text file with commands written in as you would write them at the command line. Open up notepad from the start menu. Copy the following into the file:

set terminal postscript eps

set output 'myfigure.eps'

plot 'test.csv' using 1:3 with line

Now select save as, change the filetype to All Files and save it as plot_test.plt. Adding the .plt will help you remember that this is a plot file to be used with gnuplot. Click save.

Now at the command line in gnuplot, type load 'plot_test.plt' and enter. Alternatively you can select File > open and find the plot file in your system. You should see that the file myfigure.eps appears in the directory "Data". In order to view this file you will need ghostview to be installed onto your system. We choose to use an eps format because it is a standard format that will give the highest quality figures in your work. It can be used easily with Latex, and should also import into Word.

Gnuplot can output to many different file formats. One choice that works well with windows (and word) but is not very high quality is .png. To plot with this format change terminal to png and the ending on the filename to .png. If you change this in the plot file run load "plot_test.plt" again from the command line. In order to view the file you will need to exit gnuplot.

To add a title to your graph, axis-labels or other cosmetic changes, simply add the appropriate commands before the plot command is issued. For example:

Other HowTos...

Getting Started

Including NAG dll

Optimising your programs

Return to Homepage