# How to make WGLMakie play nice with the vscode's plot pane

**URL:** <https://discourse.julialang.org/t/how-to-make-wglmakie-play-nice-with-the-vscodes-plot-pane/123424>\
**Category:** VS Code\
**Created:** [December 3, 2024, 8:03pm UTC](https://discourse.julialang.org/t/how-to-make-wglmakie-play-nice-with-the-vscodes-plot-pane/123424 "2024-12-03T20:03:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Egwene\_al\_Vere](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)\
**Post date:** [December 3, 2024, 8:03pm UTC](https://discourse.julialang.org/t/how-to-make-wglmakie-play-nice-with-the-vscodes-plot-pane/123424/1 "2024-12-03T20:03:23Z")

</div>

With CairoMakie or GLMakie, we can switch between different plots with left/right arrow, but when the backend is set to WGLMakie, this function seems broken?

Usage example could be that, especially with 3d plots, rotating/panning is easier with WGLMakie since it’s in the same vscode window and not in a separate glfw window as in GLMakie, and CairoMakie does not allow rotating 3d plots interactively

 ![Screenshot 2024-12-03 at 15.02.15](https://global.discourse-cdn.com/julialang/original/3X/0/d/0dfd2d593dc0a1c6176e55096e6c06efca13020a.png)

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [December 3, 2024, 10:02pm UTC](https://discourse.julialang.org/t/how-to-make-wglmakie-play-nice-with-the-vscodes-plot-pane/123424/2 "2024-12-03T22:02:42Z")

</div>

There’s a not much documented function in Bonito.jl that keeps the session open:

> <https://github.com/SimonDanisch/Bonito.jl/blob/master/src/connection/websocket.jl#L99-L110>

You can use that to leave the sessions of the last plotpanes open and switch between them… Let me know if it works!

---

<div class="post-metadata">

**Author:** ![Egwene\_al\_Vere](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)\
**Post date:** [December 3, 2024, 10:39pm UTC](https://discourse.julialang.org/t/how-to-make-wglmakie-play-nice-with-the-vscodes-plot-pane/123424/3 "2024-12-03T22:39:47Z")

</div>

Thanks for the tip! Except for some warning it seems to work,

```julia
┌ Warning: error while processing received msg
│ exception =
│ Plot initialized multiple times?
│ Stacktrace:
│ [1] error(s::String)
│ @ Base ./error.jl:35
│ [2] (::WGLMakie.var"#4#5"{WGLMakie.Screen, Scene})(initialized::Bool)
│ @ WGLMakie ~/.julia/packages/WGLMakie/AhDKR/src/display.jl:96
│ [3] #invokelatest#2
│ @ ./essentials.jl:1055 [inlined]
│ [4] invokelatest
│ @ ./essentials.jl:1052 [inlined]
│ [5] update_nocycle!(obs::Observable{Any}, value::Any)
│ @ Bonito ~/.julia/packages/Bonito/vh4Oz/src/rendering/observables.jl:42
│ [6] #invokelatest#2
│ @ ./essentials.jl:1055 [inlined]
│ [7] invokelatest
│ @ ./essentials.jl:1052 [inlined]
│ [8] process_message(session::Bonito.Session{Bonito.WebSocketConnection}, bytes::Vector{UInt8})
│ @ Bonito ~/.julia/packages/Bonito/vh4Oz/src/serialization/protocol.jl:36
│ [9] (::Bonito.var"#1#2"{Bonito.Session{Bonito.WebSocketConnection}, Channel{Vector{UInt8}}})()
│ @ Bonito ~/.julia/packages/Bonito/vh4Oz/src/types.jl:251
└ @ Bonito ~/.julia/packages/Bonito/vh4Oz/src/types.jl:253

```

seems to come from

> <https://github.com/MakieOrg/Makie.jl/blob/23ee755ef11e0dae6512a27ab46e9832e7c6d1cf/WGLMakie/src/display.jl#L96>
