# Using WGLMakie.jl with Dash.jl

**URL:** https://discourse.julialang.org/t/using-wglmakie-jl-with-dash-jl/63075
**Category:** New to Julia
**Tags:** gui
**Created:** [June 17, 2021, 8:44am UTC](https://discourse.julialang.org/t/using-wglmakie-jl-with-dash-jl/63075 "2021-06-17T08:44:51Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![miki\_berkovich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miki_berkovich/32/11848_2.png) [@miki\_berkovich](https://discourse.julialang.org/u/miki_berkovich)
#### Post date: [June 17, 2021, 8:44am UTC](https://discourse.julialang.org/t/using-wglmakie-jl-with-dash-jl/63075/1 "2021-06-17T08:44:51Z")

</div>

Hello, I want to create an interactive GUI based on `Dash.jl`.  
in this GUI I want to plot an image and pick a pixel using the mouse.  
in `Makie.jl` this is strait forward issue, I found that `WGLMakie.jl` can pass the makie plot to an HTML page.  
so my questions are:

1. Will I have all the interactive abilities as in the Makie standard plot?
2. If the answer to (1.) is Yes, then how can I pass the plot to the Dash.jl app as html\_div?

thanks in ahead.

---

<div class="post-metadata">

### Author: ![Jakob](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@Jakob](https://discourse.julialang.org/u/Jakob)
#### Post date: [June 17, 2021, 8:50am UTC](https://discourse.julialang.org/t/using-wglmakie-jl-with-dash-jl/63075/2 "2021-06-17T08:50:51Z")

</div>

I don’t think there is a straightforward way to use WGLMakie with Dash (I would be happy to be proved wrong, though). However, you can use PlotlyJS.jl with Dash, which also has interactive capabilities.

---

<div class="post-metadata">

### Author: ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)
#### Post date: [June 17, 2021, 9:36am UTC](https://discourse.julialang.org/t/using-wglmakie-jl-with-dash-jl/63075/3 "2021-06-17T09:36:29Z")

</div>

I got this from @sdanisch

```julia
using WGLMakie, JSServe
WGLMakie.activate!()
open("dashboard.html", "w") do io
    println(io, """
        <div>
    """)
    show(io, MIME"text/html"(), Page(exportable=true, offline=true))
    show(io, MIME"text/html"(), scatter(1:4))
    show(io, MIME"text/html"(), surface(rand(4, 4)))
    # or anything else from JSServe, or that can be displayed as html:
    show(io, MIME"text/html"(), JSServe.Slider(1:3))
    println(io, """
        </div>
    """)
end

```

(you can add head/body to be a complete html file).  
this was part of a WIP [here](https://lazarusa.github.io/BeautifulMakie/dashboards/), unfortunately I haven’t had time to finish the app (dashboard) if you do something I would like to know. (this has problems in safari, but on other browsers should be visible).

---

<div class="post-metadata">

### Author: ![miki\_berkovich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miki_berkovich/32/11848_2.png) [@miki\_berkovich](https://discourse.julialang.org/u/miki_berkovich)
#### Post date: [June 17, 2021, 11:21am UTC](https://discourse.julialang.org/t/using-wglmakie-jl-with-dash-jl/63075/4 "2021-06-17T11:21:48Z")

</div>

Hi, can I “plot” image with in PlotlyJS?  
I source the web and couldn’t find any example or API that i can use for this issue.

---

<div class="post-metadata">

### Author: ![Jakob](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@Jakob](https://discourse.julialang.org/u/Jakob)
#### Post date: [June 17, 2021, 1:20pm UTC](https://discourse.julialang.org/t/using-wglmakie-jl-with-dash-jl/63075/5 "2021-06-17T13:20:23Z")

</div>

I think you should be able to display an image directly in Dash using the corresponding html component `html_img()`.

---

<div class="post-metadata">

### Author: ![miki\_berkovich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miki_berkovich/32/11848_2.png) [@miki\_berkovich](https://discourse.julialang.org/u/miki_berkovich)
#### Post date: [June 17, 2021, 2:16pm UTC](https://discourse.julialang.org/t/using-wglmakie-jl-with-dash-jl/63075/6 "2021-06-17T14:16:42Z")

</div>

Thank you for the answer, but my main issue is with the ability to interact with the picture…  
can I get the pixel coordinates when clicked with a mouse on an entity of type `html_img`?  
As I understand `html_img` only display the image.

---

<div class="post-metadata">

### Author: ![Jakob](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@Jakob](https://discourse.julialang.org/u/Jakob)
#### Post date: [June 17, 2021, 2:32pm UTC](https://discourse.julialang.org/t/using-wglmakie-jl-with-dash-jl/63075/7 "2021-06-17T14:32:21Z")

</div>

No, `html_img()` would serve a static image. You can include interactive Plotly plots and query mouse state in Dash ([here’s](https://dash.plotly.com/interactive-graphing) the documentation on how to do it in python but it should be relatively similar in Julia). On the other hand, if you know how to do what you want in WGLMakie, maybe using [JSServe.jl](https://github.com/SimonDanisch/JSServe.jl) for the dashboard, as proposed by @lazarusA, is the better option. It isn’t really documented yet but there are many examples in the repo.

---

<div class="post-metadata">

### Author: ![miki\_berkovich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miki_berkovich/32/11848_2.png) [@miki\_berkovich](https://discourse.julialang.org/u/miki_berkovich)
#### Post date: [June 17, 2021, 2:34pm UTC](https://discourse.julialang.org/t/using-wglmakie-jl-with-dash-jl/63075/8 "2021-06-17T14:34:27Z")

</div>

Thank you, I’ll check it.
