Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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.


Comment on Re: Hover over scatter plot
Select or Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1090338]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-07-30 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (241 votes), past polls