# Function values under the cursor

**URL:** <https://discourse.julialang.org/t/function-values-under-the-cursor/3469>\
**Category:** Visualization\
**Created:** [May 1, 2017, 10:12pm UTC](https://discourse.julialang.org/t/function-values-under-the-cursor/3469 "2017-05-01T22:12:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tulio\_Valentim](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@Tulio\_Valentim](https://discourse.julialang.org/u/Tulio_Valentim)\
**Post date:** [May 1, 2017, 10:12pm UTC](https://discourse.julialang.org/t/function-values-under-the-cursor/3469/1 "2017-05-01T22:12:11Z")

</div>

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

 ![](https://global.discourse-cdn.com/julialang/original/3X/c/e/ce94df3acc10731b8ac1ce897fdcb5ec0f9d6fea.png)

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [May 1, 2017, 10:31pm UTC](https://discourse.julialang.org/t/function-values-under-the-cursor/3469/2 "2017-05-01T22:31:14Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 1, 2017, 11:12pm UTC](https://discourse.julialang.org/t/function-values-under-the-cursor/3469/3 "2017-05-01T23:12:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MA\_Laforge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ma_laforge/32/385_2.png) [@MA\_Laforge](https://discourse.julialang.org/u/MA_Laforge)\
**Post date:** [May 4, 2017, 2:26am UTC](https://discourse.julialang.org/t/function-values-under-the-cursor/3469/4 "2017-05-04T02:26:02Z")

</div>

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

 ![](https://global.discourse-cdn.com/julialang/original/3X/e/b/ebe6cf20a93f9f65ba91569004cb5c11abbeffc9.png)

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

- 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

- InspectDR.jl should work fine if you use it directly. Simply follow examples under the sample directory:
  - Samples: [InspectDR.jl/sample at master · ma-laforge/InspectDR.jl · GitHub](https://github.com/ma-laforge/InspectDR.jl/tree/master/sample)
  - Corresponding output: [FileRepo/InspectDR/sampleplots/README.md at master · ma-laforge/FileRepo · GitHub](https://github.com/ma-laforge/FileRepo/blob/master/InspectDR/sampleplots/README.md)

### 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-auto
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-auto
julia> Pkg.free("Plots")

```

---

<div class="post-metadata">

**Author:** ![Carsten](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Post date:** [February 14, 2019, 3:00pm UTC](https://discourse.julialang.org/t/function-values-under-the-cursor/3469/5 "2019-02-14T15:00:42Z")

</div>

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?
