# Interactive plotting from the REPL?

**URL:** <https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410>\
**Category:** Visualization\
**Tags:** question, plotting\
**Created:** [October 2, 2019, 2:15pm UTC](https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410 "2019-10-02T14:15:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [October 2, 2019, 2:15pm UTC](https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410/1 "2019-10-02T14:15:57Z")

</div>

Goal is to do some interactive plotting from the REPL on linux (not using an Atom or Jupyter web browser)

> [@\[ANN\] Fatou.jl : Easily share Julia fractals](https://discourse.julialang.org/t/ann-fatou-jl-easily-share-julia-fractals/12278):
>
> This package enables users of Julia lang to easily generate, explore, and share fractals of Julia, Mandelbrot, and Newton type. The name Fatou comes from the mathematician after whom the Fatou sets are named. Definition (Julia set): For any holomorphic function on a complex plane, the boundary of the set of points whose result diverges when the function is iteratively evaluated at each point. Definition (Fatou set): The Julia set’s complement is the set of fixed limit points from holomorphic r…

Previously I made the [Fatou.jl](https://github.com/chakravala/Fatou.jl) package and I would like to make an interactive plot inspired by the repo:

> **[GitHub - chrizbee/NewtonFractal: Qt application to visualize newton fractals](https://github.com/chrizbee/NewtonFractal)**
>
> Qt application to visualize newton fractals. Contribute to chrizbee/NewtonFractal development by creating an account on GitHub.

Have a look at their GIF in the readme for the interactive plotting visualization example.

Is this something that can be accomplished from the REPL plotting in Julia somehow?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [October 2, 2019, 2:29pm UTC](https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410/2 "2019-10-02T14:29:42Z")

</div>

I’m not sure what you mean with “from the REPL” but it seems that Makie would be good for this since it should update the canvas quickly and handle mouse events.

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [October 2, 2019, 2:32pm UTC](https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410/3 "2019-10-02T14:32:51Z")

</div>

> [@kristoffer.carlsson](#):
>
> I’m not sure what you mean with “from the REPL”

What I mean is that I don’t want to run Julia from Juno or Atom or Jupyter, I want to interactively plot from the REPL in the standard unix environment without using any web-browser interfaces.

Can Makie be used without the web browser interface? I’d prefer something like a Qt popup window.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [October 2, 2019, 2:44pm UTC](https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410/4 "2019-10-02T14:44:16Z")

</div>

Makie just pops up a render window like any other plotting / GUI tool.

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [October 2, 2019, 5:46pm UTC](https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410/5 "2019-10-02T17:46:37Z")

</div>

There are two Mandelbrot examples and one Julia set example in the [examples](https://github.com/jheinen/GR.jl/tree/master/examples) section of GR.jl - two plain Julia scripts (`mandel.jl`, `julia.jl`) and an OpenCL accelerated Mandelbrot script.

---

<div class="post-metadata">

**Author:** ![mbaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbaz/32/17295_2.png) [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Post date:** [October 2, 2019, 10:23pm UTC](https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410/6 "2019-10-02T22:23:20Z")

</div>

> [@chakravala](#):
>
> I don’t want to run Julia from Juno or Atom or Jupyter, I want to interactively plot from the REPL in the standard unix environment without using any web-browser interfaces.

Gaston works this way. It can plot arrays as a set of points, so it can plot fractals if you store them as arrays.

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [October 2, 2019, 10:47pm UTC](https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410/7 "2019-10-02T22:47:26Z")

</div>

What about making the plot interactive?

I already know I can plot fractals in plotting packages.

To answer my question you would also have to take the interactivity into account, like mouse hover and click and drag and so on… can they do that? Please show how I would make an interactive plot that updates with click and drag coordinate parametric interactivity.

For example, placing dots into the plot and clicking and dragging them into to new configurations. The plot should be re-computed with the new configurations.

---

<div class="post-metadata">

**Author:** ![mbaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbaz/32/17295_2.png) [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Post date:** [October 2, 2019, 11:10pm UTC](https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410/8 "2019-10-02T23:10:17Z")

</div>

Yeah, Gaston (or rather, gnuplot) is not designed to do that. It wasn’t clear to me from your question and comments what you meant by ‘interactive’.

---

<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:** [October 5, 2019, 1:10am UTC](https://discourse.julialang.org/t/interactive-plotting-from-the-repl/29410/9 "2019-10-05T01:10:23Z")

</div>

InspectDR written in Julia, so you can add interactivity if you wish.

It was not _ **designed** _ to hook in custom callbacks yet, but you can use “dynamic patching” (guerrilla patch/monkey patch) to “hack” in your own hooks at the moment.

You can find an example of this here:

> [@Recording mouse position coordinates in plots?](https://discourse.julialang.org/t/recording-mouse-position-coordinates-in-plots/28848/12):
>
> Correct @davide: First example The first example does not work at the moment. I think it is supposed to work, but the "button-press-event" signal already has a connection in the InspectDR code. I think this is a bug with Gtk. I am almost certain you are supposed to be able to connect multiple callback functions to the same “signal”. I merely included the example in case you better understood how Gtk worked, and knew how to get around the problem. Second example As for the second example:…

Note that it might be more appropriate to overwrite the callback functions instead of the `handleevent_mousepress()` function. I can guide you through that if you want.

### Limitations

InspectDR does not support heat map or contour plots - so you probably don’t want to use it for drawing fractals. But it does work fine for 2D line plots.

### Layered design

InspectDR typically is used as a plot application, but you could also instantiate an individual InspectDR plot widget within your custom, interactive Gtk application.

…But if you want to do that, you might want an overview of how the code was divided into files. I will only do that if you ask, I don’t feel like explaining this for nothing.
