Tuesday, October 29, 2013

Installing and Running Gnuplot on Ubuntu

Gnuplot is simple to install and use on Ubuntu systems as the latest version is included in the Ubuntu repositories. One part that is not included by default is auto complete at the gnuplot command line. In order to install gnuplot and enable auto complete, simply open a terminal, and type the following command

sudo apt-get install gnuplot rlwrap

UPDATE On Ubuntu 12.04 and later you need to specify what version of gnuplot to install (qt or x11), so change the command above to

sudo apt-get install gnuplot-qt rlwrap

Then open your bash configuration file (if using the default bash shell)

gedit ~/.bashrc &

and add the following lines to the file somewhere near the bottom

# enable autocomplete in gnuplot
alias gnuplot="rlwrap -a -c -b\"\\\"\\\"\\\'\\\'\" gnuplot"

save the file and exit.

First we need some data for plotting, for instance the file


may be downloaded from my website.

Now open a new terminal and type gnuplot into the command line. You should see the following:

Now enter the following:

p 'te

and press the tab key. The filename should auto complete. If it does not appear press the tab key again as there might be multiple files beginning `te', and you might need to enter more letters to allow it to complete. If it is still not working, enter !ls and check that the file is present in your current working directory. Complete the gnuplot command to plot the file with lines and press return

p 'testResults.dat' w l

If it all works you should see:


  1. If you just put the first letter of the file and then press the tab key it also works, including the dir before "./fichero" .
    And this is without installing another editor...

  2. Bonjour, j'ai un message d'erreur lors de la vérification du bon fonctionnement du logiciel :

    G N U P L O T
    Version 4.6 patchlevel 0 last modified 2012-03-04
    Build System: Linux x86_64

    Copyright (C) 1986-1993, 1998, 2004, 2007-2012
    Thomas Williams, Colin Kelley and many others

    gnuplot home: http://www.gnuplot.info
    faq, bugs, etc: type "help FAQ"
    immediate help: type "help" (plot window: hit 'h')

    Terminal type set to 'unknown'

    gnuplot> p 'testResults.dat' wl
    ';' expected

    pouvez-vous m'aider svp ? Merci.

  3. Hi Dritz,

    You need a space between the w and l. The 'p', 'w' and 'l' are short for 'plot' 'with' 'lines'. You may also write:

    plot 'testResults.dat' with lines


  4. can i follow same procedure for gnuplot-4.6.0 on ubantu 12.04??

  5. Just updated this. You need to install gnuplot-qt now as there is no longer any default terminal.

  6. Which one is better gnuplot qt or x11 version for scientific computations plotting ??

  7. Thanks for sharing. Works great! Just one suggestion: for proper using of external programs within gnuplot, e.g. "! less someFile.dat" add the option "-N" or "--no-children" to the rlwrap call.

  8. i did every thing, but no graph appear.
    what I should do?

  9. how you plot the sloshing tank data in cfd Openfoam by using this gnuplot, help me please.
    here my email address.
    thank you

  10. I have run the 'testresults' in gnuplot and plotted successfully.
    But I could not able to save the plot in ubuntu 10.04.
    Someone pls help me to save the plot.

  11. i want to plot the graph by my own values plz help me

  12. Replies
    1. The qualitative data analysis spss have the most reasonable rates of any company offering qualitative and quantitative data analysis