Install Gnuplot 4.4.0 on Ubuntu Linux

The most frequented blog entries here are about installing Gnuplot on Ubuntu Linux or Mac OS X. These entries are still valid for the newer Ubuntu versions. But Gnuplot newest version 4.4.0 was already released, and in this release there are cairo based pdf and png terminals provided. So you don’t need the pdflib anymore. Below you’ll find updated instructions to compile and install Gnuplot 4.4.0 with wxt and pdfcairo terminal. These instructions were tested on Ubuntu 8.04 (Hardy Heron) and Ubuntu 9.10 (Karmic Koala) and should also work on 8.10 (Intrepid Ibex) and 9.04 (Jaunty Jackalop).

Prerequisites

We need to make sure some packages are already installed before we try to compile gnuplot

  • libwxgtk2.8-dev – for the wxt terminal
  • libpango1.0-dev – for the cairo (pdf, png) and wxt terminals
  • libreadline5-dev – readline support (editing command lines)
  • libx11-dev and libxt-dev – X11 terminal
  • texinfo (optional) – needed for the tutorial
  • libgd2-xpm-dev (optional) – old png, jpeg and gif terminals based on libgd

This command (run in a terminal) will install all prerequisites if not already installed:

sudo apt-get install libwxgtk2.8-dev libpango1.0-dev libreadline5-dev libx11-dev libxt-dev texinfo libgd2-xpm-dev

Then we download and compile gnuplot (run each command/line in a terminal)

  • wget http://sourceforge.net/projects/gnuplot/files/gnuplot/4.4.0/gnuplot-4.4.0.tar.gz/download
  • tar xzf gnuplot-4.4.0.tar.gz
  • mkdir build && cd build
  • ../gnuplot-4.4.0/configure --with-readline=gnu

check if you find the lines in the output at the bottom:

X Window System terminal: yes
jpeg terminal: yes
gif terminal: yes (with animated gif)
png terminal: yes
    (jpeg, gif and png terminals can use TTF fonts)
wxt terminal: yes
cairo-based pdf and png terminals: yes
Readline library: GNU readline library with  -lncurses
  • make

(if you have problems here with some latex errors than disable the latex tutorial during the configure stage with “--without-tutorial”, if you get a “103: makeinfo: not found” error message than install the texinfo package)

  • sudo make install

Then you have gnuplot installed with nice readline support (command line like in bash), a nice new wxWidgets terminal and a pdf terminal based on cairo.

41 thoughts on “Install Gnuplot 4.4.0 on Ubuntu Linux

  1. Thanks for this update – I used your site ages ago to set up PDF support in Hardy, and it’s good of you to keep these things up to date.

  2. sorry for my stupid question, but i’m an absolute beginner in ubuntu and gnuplot. the new release is out, is your install tutorial still valid? what’s changed (about prerequisites)?
    thanks for your help.

  3. Hi Maurizio, sure this tutorial is also valid for Gnuplot 4.4.0. Prerequisites are the same.

    HTH,
    WErner

  4. sorry, i didn’t understand ‘So you don’t need the pdflib anymore.’ 🙂
    i’ll follow your instructions, thanks.

  5. i got this make error:

    /usr/lib/libwx_baseu-2.8.so: undefined reference to `std::ctype::_M_widen_init() const@GLIBCXX_3.4.11′
    collect2: ld returned 1 exit status
    make[3]: *** [gnuplot] Errore 1
    make[3]: uscita dalla directory «/home/user_name/Scrivania/build/src»
    make[2]: *** [all-recursive] Errore 1
    make[2]: uscita dalla directory «/home/user_name/Scrivania/build/src»
    make[1]: *** [all-recursive] Errore 1
    make[1]: uscita dalla directory «/home/user_name/Scrivania/build»
    make: *** [all] Errore 2

    is it a serious error? make install is a disaster 🙁
    [i’m italian: scrivania = desktop, errore = error, uscita dalla directory = exit from directory]

  6. i use ubuntu 9.10.
    i give up the idea of installing gnuplot. i’m afraid downgrading GCC versions breaks the linking of a lot of C++ libraries and i NEED them for my work software (OpenFOAM, etc.). how can i remove the partial gnuplot install? is it enough to delete the gnuplot-4.4.0 and build folders on my desktop?
    thanks for your help.

  7. You actually don’t need to downgrade, usually Ubuntu provides more then one gcc version. You can install an older one and then choose one before calling cmake via

    export CC=”gcc-4.2″
    export CXX=”g++-4.2″
    cmake ….

    or similar. Anyway, as long as you didn’t run “make install” all files are in the build folder. Just delete them. If you did run “make install”, try to run “make uninstall” before you delete the build folders, this might get rid of all installed files. Alternatively run “make install” and see where the files were copied to.

  8. ehi, wait a moment! i’m a newbie! 😀
    please, give me step-by-step instructions… could i install a lower gcc version (e.g. 4.3), coexistent with gcc 4.4, and then type (instead of the simple ‘make’ of your above instructions):
    export CC=”gcc-4.3″
    export CXX=”g++-4.3″
    cmake?
    please, how can i install gcc-4.3? i see quite a few packages (source, base, multilib…).

  9. Hello, having ‘make install’ trouble also. here’s the last bit of output:

    test -z “/usr/local/usr//usr/local/texlive/2009/../texmf-local/tex/latex/gnuplot” || /bin/mkdir -p “/usr/local/usr//usr/local/texlive/2009/../texmf-local/tex/latex/gnuplot”
    /usr/bin/install -c -m 644 ../../../gnuplot-4.4.0/share/LaTeX/gnuplot.cfg ../../../gnuplot-4.4.0/share/LaTeX/gnuplot-lua-tikz.sty ‘/usr/local/usr//usr/local/texlive/2009/../texmf-local/tex/latex/gnuplot’
    make install-data-hook
    make[4]: Entering directory `/home/ben/Downloads/build/share/LaTeX’
    test -n “” || texhash
    /bin/bash: texhash: command not found
    make[4]: *** [install-data-hook] Error 127
    make[4]: Leaving directory `/home/ben/Downloads/build/share/LaTeX’
    make[3]: *** [install-data-am] Error 2
    make[3]: Leaving directory `/home/ben/Downloads/build/share/LaTeX’
    make[2]: *** [install-am] Error 2
    make[2]: Leaving directory `/home/ben/Downloads/build/share/LaTeX’
    make[1]: *** [install-recursive] Error 1
    make[1]: Leaving directory `/home/ben/Downloads/build/share’
    make: *** [install-recursive] Error 1

    Any ideas?

  10. Hi Ben. You’re missing the texhash command (“/bin/bash: texhash: command not found”). According to this page (http://ns2.canonical.com/karmic/i386/texlive-base-bin/filelist) you should install the Ubuntu package texlive-base-bin (assuming you use Ubuntu):

    sudo apt-get install texlive-base-bin

    But I assume you have that package already. Maybe uninstall and reinstall the whole tex packages. Anyway, a fast workaround would be to use the configure option “–without-tutorial” – The tutorial won’t then be built – it’s available on http://www.gnuplot.info anyway.

    HTH,
    Werner

  11. Hi Werner,

    I’ve already got texhash, but I think the real problem was I needed to tell configure the tex directories. It actually tells you it isn’t very good at finding them. I’ve now got gnuplot 4.4 installed on one machine, will try the other one during the week.

    thanks for this post, made it easy for me!

    ben.

  12. Thanks for your documentation. I just have two comments for clarity:

    1. Concerning “../gnuplot-4.4.0/configure –with-readline=gnu”: the character in front of with should be a “–”

    2. I need to make a sudo in front of make install: “sudo make install”

    Thanks again!

  13. Hi seb,

    thanks I improved the tutorial so it’s clear now, that we need two – in front of with-readline. Unfortunately wordpress makes one – out of two — (even in your post ;). Also added the sudo.

    Thanks,
    Werner

  14. hi, werner.

    i hope to not annoy you. i need your help, please.
    on april 3 i read your answer to my comment, but i’m an absolute ubuntu beginner. meanwhile i’ve been looking for documentation (i didn’t understand anything about gcc), but i can’t manage to install gnuplot.
    you said i don’t need to downgrade because i can install an older gcc version (e.g. 4.3), coexistent with gcc 4.4, am i correct?
    then you said:

    export CC=”gcc-4.2″
    export CXX=”g++-4.2″
    cmake…

    may you mean that i must type that code, between ‘configure’ and ‘make’, but why ‘cmake’ and not ‘make’, as in your tutorial?
    be patient, i’m a newbie.

    greetings,

    maurizio

  15. Thank you SO much!! I spent the whole day trying to find why I could not use gnuplot, and it turned out so much better to just follow your instructions and install a newer version… Now I can get to actually do what I needed to do in the first place!
    THANKS!
    🙂

  16. After installing I wasn’t able to read the help files. I had to run:

    sudo chmod o+x `sudo find /usr/local/share/gnuplot/ -type d`

    in order to access them.

  17. hi every one i have installed gnuplot. can any one tell me how i open now and how i plot my ns-3 simulation graph on this,i shell be very thankful to you.

  18. If you run “make install” you should just type “gnuplot” to start gnuplot. I don’t know what ns-3 simulation data is and how this graph should look like, but you could start here: http://gnuplot.sourceforge.net/demo_4.4/ and see if one of the scripts suits your need. Also a good read is “Gnuplot in Action” which is really helpful for beginnners.

    Werner

  19. Hello author

    I was banging my head off a wall trying to install Gnuplot on my Ubuntu partition. Many thanks for the help, now I am taking my work home and cant seem to relax!!

  20. Hi,
    after the command ../gnuplot-4.4.3/configure –with-readline=gnu

    I get the following message:

    gnuplot will be compiled with the following options:

    Readline library: GNU readline library with -lncurses
    Command-line history file: yes
    Check current directory for .gnuplot file: no (use –with-cwdrc to enable)
    Sort help/subtopic tables by column: no (use –without-row-help to enable)
    Use TeX kpsexpand to search for fonts: no (use –with-kpsexpand to enable)
    Thin plate splines: no (use –enable-thin-spline to enable)
    Hidden3d optimization: quadtree
    Deprecated syntax and terminal options : no (use –enable-backwards-compatibility to enable)

    gnuplot will install the following additional materials:

    lasergnu printer script: no (use –with-lasergnu to enable)
    gnuplot-mode for X/Emacs: yes
    LaTeX tutorial: yes
    cfg file for epslatex terminal: yes
    TeX *.sty for lua/tikz terminal: no
    TeX files will be installed in /usr/local/share/texmf/tex/latex/gnuplot
    (use –with-texdir=DIR to change)
    Help file: yes (always), in ${datarootdir}/gnuplot/4.4/gnuplot.gih
    PostScript prologue files: yes (always)

    it’s different from the output you present. Will gnuplot install correctly? (I use Ubuntu 10.04 LTS)

    Thanks,

    Marios

  21. Thanks for the post. Worked very well for me. Was struggling to get gnuplot working before I saw this.
    Thanks a lot.

  22. Thanks for posting this; it saved me some time fishing around for dev packages.

    FWIW, these instructions work fine for gnuplot 4.4.3 backported to Ubuntu Karmic Koala. I added texlive-latex-extra to get the missing subfigure.sty file for satisfying the documentation build; this isn’t important if you just want a functional gnuplot binary though.

  23. Hello, I am very new with ubunto and gnuplot. Was trying to follow your instructions and got stuck at the line below. Wonder if you can kindly help me? Thanks in advance. Dr

    dr@dr-VirtualBox:~$ tar xzf gnuplot-4.4.0.tar.gz
    tar (child): gnuplot-4.4.0.tar.gz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    dr@dr-VirtualBox:~$ ^C
    dr@dr-VirtualBox:~$

  24. hi, it seems that gnuplot wasn’t downloaded. repeat the wget command, or download gnuplot 4.4 using the http line with your browser. with

    ls

    you can view, if gnuplot is in the current folder.

  25. Thanks a million for everything. This is what I got:

    dr@dr-VirtualBox:~$ wget http://sourceforge.net/projects/gnuplot/files/gnuplot/4.4.0/gnuplot-4.4.4.tar.gz/download
    –2012-01-27 16:14:32– http://sourceforge.net/projects/gnuplot/files/gnuplot/4.4.0/gnuplot-4.4.4.tar.gz/download
    Resolving sourceforge.net… 216.34.181.60
    Connecting to sourceforge.net|216.34.181.60|:80… connected.
    HTTP request sent, awaiting response… 301 Moved Permanently
    Location: http://sourceforge.net/projects/gnuplot/files/ [following]
    –2012-01-27 16:14:32– http://sourceforge.net/projects/gnuplot/files/
    Connecting to sourceforge.net|216.34.181.60|:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: 22323 (22K)
    Saving to: `download.1′

    100%[======================================>] 22,323 –.-K/s in 0.1s

    2012-01-27 16:14:34 (182 KB/s) – `download.1′ saved [22323/22323]

  26. Thanks a million. Managed to download it using my browser. All is well now after following your very clear steps. Now…the agony of learning gnuplot!!
    You have been a great help.
    Best regards,
    Dr

  27. Hi again, I have one question. If I have an eps fine (e.g. test.eps) how can I view it outside gnuplot? One guy said just type (open test.eps) and you should be able to view it. I can’t. I think I’m missing a program that goes with (open) command. Can you kindly guide me?
    Thanks a million in advance
    Dr

  28. Hi
    I installed gnuplot-4.6.0 on ubuntu10.04 but I don’t have the png terminal !!
    Please can you help me
    Really I need your help
    Thank you

  29. Great tutorial! Concise and to the point.
    Save me a lot of grief and time.
    Thanks a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.