Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot wxt not working anymore

Tags:

gnuplot

I have recently upgraded to Debian jessie, meaning that I have upgraded from gnuplot 4.6.0 to gnuplot 4.6.6 (issue is the same with gnuplot 5.0).

I have bash scripts automating things, and launching gnuplot terminal.

I was using either:

gnuplot -persist -e "set title 'Sine curve'; plot sin(x)"

or

gnuplot -persist <<EOF                                   
set title 'Sine curve'
plot sin(x)
EOF

The terminal wxt is no more distributed by debian (and derivatives like ubuntu), because of #751441.

I am using now terminal qt. It displays the plot, but that's the end. The window is static and most of the buttons do not work. I cannot zoom, I cannot unzoom, I cannot show the grid.

How to circumvent this?

like image 441
thdox Avatar asked May 16 '15 10:05

thdox


1 Answers

Answering my own question: I spent two much time googling, trying to understand why, reading excuses to not correct it, and finding workarounds.

First, you have to remove -persist because it has a wxt special way of working, and it is not the same way of working with qt terminal. See #1418.

Second, you have to add "pause mouse close" after your plot. See #1418. The script is now:

gnuplot -e "set title 'Sine curve'; plot sin(x); pause mouse close"

Now the zoom in, zoom out, and show grid are working.

Third, wait, you did not plotted a sinus, but with lines. Like this example:

$ gnuplot <<EOF
plot '-' using 1:2 t '' with line
0 0
10 10
e
pause mouse close
EOF

Now, if you zoom somewhere in the middle of a segment, you get nothing, an empty and blank screen. What you need is set clip two that tells to not clip when segments ends are not shown. See #1419. So the following will work:

$ gnuplot <<EOF
set clip two
plot '-' using 1:2 t '' with line
0 0
10 10
e
pause mouse close
EOF

Finally, what I have done, is:

  1. add pause mouse close at the end of the script
  2. add set clip two in ~/.gnuplot file

With this, I can mimic the wxt way of working while using qt terminal. IMHO, as a basic end-user, this should be the default.

like image 103
thdox Avatar answered Nov 13 '22 13:11

thdox