# Need help plotting using Blink and Interact

**URL:** <https://discourse.julialang.org/t/need-help-plotting-using-blink-and-interact/48644>\
**Category:** Visualization\
**Created:** [October 19, 2020, 4:51pm UTC](https://discourse.julialang.org/t/need-help-plotting-using-blink-and-interact/48644 "2020-10-19T16:51:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![groovyda](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@groovyda](https://discourse.julialang.org/u/groovyda)\
**Post date:** [October 19, 2020, 4:51pm UTC](https://discourse.julialang.org/t/need-help-plotting-using-blink-and-interact/48644/1 "2020-10-19T16:51:02Z")

</div>

Hi there

I have a simple interactive plot (in Pluto) that is slow - and should benefit from using Blink instead. I have spent the last day trying to make it work, but I just can’t figure out how to.

Could someone please show me how to translate this into a plot that displays interactively in Blink? I’m agnostic to the back-end - PlotlyJS / InspectDR. A working example would be really really good!

```julia

@bind θ Slider(0:0.05:2π+0.1, show_value=true)

Q = [cos(θ) -sin(θ)
	sin(θ) cos(θ)]

Λ = [2 0; 0 0.5]
QΛQh(x) = Q * Λ * Q' * x

ts = 0:0.01:2π
Qs = [QΛQh([cos(t), sin(t)]) for t in ts]
xs = [q[1] for q in Qs]
ys = [q[2] for q in Qs]

plot(cos, sin, 0, 2π, ratio=1) # Plots a circle
plot!(xs, ys)

```

After this - I try and also show a current ‘x’ vector, and its translation on the same plot using plot!. But if someone can please show me how to send the above to Blink (with Interact or Makie or anything)- I can then do the rest.

Many thanks!

---

<div class="post-metadata">

**Author:** ![groovyda](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@groovyda](https://discourse.julialang.org/u/groovyda)\
**Post date:** [October 20, 2020, 6:56am UTC](https://discourse.julialang.org/t/need-help-plotting-using-blink-and-interact/48644/2 "2020-10-20T06:56:26Z")

</div>

OK - to anyone else with this question, the following code seems to work - EXCEPT if you choose plotlyjs() as the backend. Not sure why.

gr() is quite fast - plotly() is laggy.

```julia
using Interact, Plots, Blink

gr() # plotly, inspectdr work too - but not plotlyjs - not sure why

win = Window()

mp = @manipulate for θ₁=0:0.05:2π+0.1, θ in 0:0.05:2π+0.1

        pt_x = [cos(θ₁), sin(θ₁)]

        Q = [cos(θ) -sin(θ)

        sin(θ) cos(θ)]

        Λ = [2 0; 0 0.5]

        QΛQh(x) = Q * Λ * Q' * x

        ts = 0:0.01:2π

        Qs = [QΛQh([cos(t), sin(t)]) for t in ts]

        xs = [q[1] for q in Qs]

        ys = [q[2] for q in Qs]

        plot(cos, sin, 0, 2π, ratio=1)

        plot!(xs, ys)

        plot!([0, pt_x[1]], [0, pt_x[2]])

        plot!([0, QΛQh(pt_x)[1]], [0, QΛQh(pt_x)[2]])

end

body!(win, vbox(mp))

```
