Function values under the cursor

Hi, someone could help me to plot a graph that show the function value under the cursor?
For example in the image below if the black point is cursor it will show (-0.5,2)

Tks

1 Like

If you are using IJulia, then you can do this with Plots.jl and plotly:

using Plots
plotly()
plot(linspace(-1, 1).^2)
1 Like

And if you’re using Plots with Juno, the plotlyjs() backend will do it. Just swap out that plotly() command. And if you’re at the REPL, plotlyjs() will give you a GUI window with that interactivity, while plotly() will open it in a browser.

1 Like

The InspectDR backend was built with this kind of interactivity in mind:

InspectDR.jl: GitHub - ma-laforge/InspectDR.jl: Fast, interactive Julia/GTK+ plots (+Smith charts +Gtk widget +Cairo-only images)

  • Coordinates show up in the bottom-left corner when you hover over the plot.
  • You can also add single markers (using key “r” over point of interest)
  • You can follow up with one or more delta markers by using the “d” key.

Eventually, the intent was to have the cursor track the plot data so that all displayed coordinates are meaningful, but for now, all features are “floating” in the plot window.

How to use directly

How to use with Plots.jl (At the time of writing)

  • To use the new features of InspectDR using Plots.jl as a “frontend”, you must currently check out the master branch of Plots.jl:
julia> Pkg.checkout("Plots")

Just remember to eventually restore Plots.jl to its most recent “tagged” version once Tom (the maintainer of Plots.jl) creates a new release:

julia> Pkg.free("Plots")

Would it be possible to read out the cursor positions (x,y) which are displayed in the active PyPlot-window in order to use the values for further tasks? And how can I manage this?