Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Hover over scatter plot

by ambrus (Abbot)
on Jun 18, 2014 at 18:58 UTC ( #1090338=note: print w/replies, xml ) Need Help??

in reply to Hover over scatter plot

I usually draw plots using gnuplot. See Plot a spiral with gnuplot for an educational example.

Most interactive terminals (rendering frontend drivers) of gnuplot support using the mouse. These include the wxt and x11 terminals.

If you make a plot on such a terminal, then hover the mouse over the plot window, the coordinates of the hovered points will show up printed in the corner of the plot window. If you click the mouse, gnuplot stores the coordinates in the variables MOUSE_X and MOUSE_Y, which you can query with the print statement of gnuplot. I believe you can even bind a callback function gnuplot will execute on mouse clicks, see the gnuplot manual for details.

There is one limitation of mouse handling that is worth noting. If you are using a multiplot (multiple independent plot areas side by side in a window), then you can get the coordinates corresponding to the last plot area only.

Replies are listed 'Best First'.
Re^2: Hover over scatter plot
by Anonymous Monk on Jul 02, 2014 at 05:43 UTC

    Chart::Gnuplot works with Gnuplot in Perl. Just setting the "terminal" option of the "chart" object (e.g. "x11" in Linux or "windows" in Windows) will pop up an interactive window with mouse hover feature, i.e.

    my $chart = Chart::Gnuplot->new( terminal => "x11", .... );
    Here has more examples about Chart::Gnuplot.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1090338]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2018-05-24 01:38 GMT
Find Nodes?
    Voting Booth?