sdaau
sdaau

Reputation: 38619

Interactively show/hide plots in gnuplot?

(just documenting - self-answer to follow)

In gnuplot, I can have two plots (say, sin(x) and cos(x) like this:

gnuplot> plot sin(x), cos(x)

which provides a graph like this:

gnuplot window

I'd like to interactively click on something, and (say) hide sin(x) - then again click somewhere with the mouse to show it.

I've seen (in http://gnuplot.sourceforge.net/demo_canvas_4.6/) that it is possible to do that with a HTML5 canvas terminal - in my Firefox, I can click on the small circled 1 in the demo, to show/hide one of the plots there. Unfortunately, it seems that the canvas terminal is only available for gnuplot 4.6 - while I'm using 4.4.

Is there a similar sort of facility for the interactive terminals in earlier versions of gnuplot?

Upvotes: 4

Views: 2090

Answers (1)

sdaau
sdaau

Reputation: 38619

Indeed, it turns out there is - I just couldn't find anything in the documentation.

First you need to click on the wrench icon ("Open configuration dialog") on the wxt terminal window; in there, there is an option "Toggle plots on/off when key sample is clicked", which should be enabled.

If it is, then one can simply click on the function entry in the legend (that is, the key), and the visibility of that particular plot will be toggled there.

NB: The phrase "key sample" confused me, because if you plot data of, say, 2 points (say, (0,0) and (1,1)) with, say, linespoints, then you'd get "points" at (0,0) and (1,1), and a line that connects them; usually I would have considered the "points" to be "key samples" (in analogy to "key frames"), whereas the line would represent "interpolated samples" - but that is not the meaning here; here clicking on "key sample" means clicking on the entry in the legend!

Hope this helps someone,
Cheers!

Upvotes: 4

Related Questions