47

I am using gnuplot under ubuntu 12.10. When i type in terminal :

gnuplot> plot sin(x)

it only shows next step:

gnuplot> 

but it doesn't show the graph plotting windows. What can I do to find the problem?

  • What else have you tried. Can you set the terminal to wxt? – DrSAR Apr 3 '13 at 7:06
62

You might be missing gnuplot-x11. Try to install it. In the commandline, do this:

sudo apt-get install gnuplot-x11
| improve this answer | |
  • this is exactly what is required, the reason is that gnuplot is otherwise not able to set the terminal to wkt. – Ashutosh Gupta Aug 6 '17 at 4:54
7

Add -p

If you are doing:

gnuplot -e 'p sin(x)'

add a -p, it helps a lot:

gnuplot -p -e 'p sin(x)'

man gnuplot documents:

-p, --persist lets plot windows survive after main gnuplot program exits.

enter image description here

Tested on gnuplot 5.0 patchlevel 3, Ubuntu 16.04.

| improve this answer | |
1

The problem seems to be the 'unknown' terminal type. The separate window for the output is generated by wxWidget library. If this package is not installed on your machine, no window would be created at all. However, to draw something in this window, you need two other packages, as wxWidget does not draw anything. All these packages can be installed at once by the following command.

sudo apt-get install libcairo2-dev libpango1.0-dev libwxgtk2.8-dev

Be warned that wxWidget (libwxgtk) must be 2.8 and not 3.0 if you are installing it from source instead of repository. After installing all these, it is safer to throw away gnuplot source folders from your machine. Download latest gnuplot and extract it in the folder you want to install in. Finally, you should make a change in the configure file that you got with the gnuplot source. Locate the following line in it:

 wxt terminal: no (requires C++, wxWidgets>2.6, cairo>0.9, pango>1.10)

and change that no to yes and save it. After this run commands ./configure, then make and finally sudo make install. Now gnuplot should be working fine.

Edit : Today I found out another issue related to wxt terminal. So sometimes even after following the procedure outlined above, you don't get that beautiful wxt terminal in Ubuntu 14. The little hack is like this (I am not explaining this, just follow it!)

sudo apt-get purge libwxbase3.0-dev wx3.0-headers libwxgtk3.0-0

And then delete the gnuplot from bin folder. Finally repeat what is given above.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.