# From GLMakie v0.4.7 to GLMakie v0.9.9

**URL:** <https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607>\
**Category:** Visualization\
**Tags:** question, package, glmakie\
**Created:** [March 14, 2024, 8:42am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607 "2024-03-14T08:42:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 14, 2024, 8:42am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/1 "2024-03-14T08:42:53Z")

</div>

I am porting [this code](https://github.com/aenarete/KiteViewers.jl/blob/main/src/viewer3D.jl) from GLMakie v0.4.7 to GLMakie v0.9.9.  
This means from Makie 0.15.3 to Makie 0.21.0 (I think).

See also: [Migrating from GLMakie 0.4.7 to current](https://discourse.julialang.org/t/migrating-from-glmakie-0-4-7-to-current/79913)  
I tried this already two years ago and failed, but now I must succeed.

I could not find a list of depreciations, so I have to ask item by item.

First question: How can I replace the type `Node` which does not longer exist?  
 → answer: use Observable instead

Second error:

```julia
LoadError: UndefVarError: `Quaternionf0` not defined

```

→ answer: use Quaternionf instead

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [March 14, 2024, 9:08am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/2 "2024-03-14T09:08:54Z")

</div>

It’s `Quaternionf`.

To find all such changes, look at the file `CHANGELOG.md` in the Makie repository. Searching for “deprecate” or “remove” should find most of them.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 14, 2024, 9:21am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/3 "2024-03-14T09:21:39Z")

</div>

Thanks. This is what grep gave me:

- Broadcast replaces deprecated method for quantile [#2430](https://github.com/MakieOrg/Makie.jl/pull/2430).

- The functions `hlines!`, `vlines!`, `hspan!`, `vspan!` and `abline!` were reimplemented as recipes. This allows using them without an `Axis` argument in first position and also as visuals in AlgebraOfGraphics.jl. Also, `abline!` is now called `ablines!` for consistency, `abline!` is still exported but deprecated and will be removed in the future. [#2023](https://github.com/MakieOrg/Makie.jl/pulls/2023).

- **Breaking** deprecate `to_colormap(cmap, ncolors)` in favor of `categorical_colors(cmap, ncolors)` and `resample_cmap(cmap, ncolors)` [#1901](https://github.com/MakieOrg/Makie.jl/pull/1901) [#1723](https://github.com/MakieOrg/Makie.jl/pull/1723).

- Switched to erroring instead of warning for deprecated events `mousebuttons`, `keyboardbuttons` and `mousedrag`.

- Added `SliderGrid` block which replaces the deprecated `labelslider!` and `labelslidergrid!` functions [#1796](https://github.com/MakieOrg/Makie.jl/pull/1796).

- **Breaking** Cleaned up `Scene` type [#1192](https://github.com/MakieOrg/Makie.jl/pull/1192), [#1393](https://github.com/MakieOrg/Makie.jl/pull/1393). The `Scene()` constructor doesn’t create any axes or limits anymore. All keywords like `raw`, `show_axis` have been removed. A scene now always works like it did when using the deprecated `raw=true`. All the high level functionality like showing an axis and adding a 3d camera has been moved to `LScene`. See the new `Scene` tutorial for more info: [Scene tutorial · Makie](https://docs.makie.org/dev/tutorials/scenes/).

- Depend on new GeometryBasics, which changes all the Vec/Point/Quaternion/RGB/RGBA - f0 aliases to just f. For example, `Vec2f0` is changed to `Vec2f`. Old aliases are still exported, but deprecated and will be removed in the next breaking release. For more details and an upgrade script, visit [GeometryBasics#97](https://github.com/JuliaGeometry/GeometryBasics.jl/pull/97).

- **Breaking** The attribute `textsize` has been removed everywhere in favor of the attribute `fontsize` which had also been in use.

- The functions `hlines!`, `vlines!`, `hspan!`, `vspan!` and `abline!` were reimplemented as recipes. This allows using them without an `Axis` argument in first position and also as visuals in AlgebraOfGraphics.jl. Also, `abline!` is now called `ablines!` for consistency, `abline!` is still exported but deprecated and will be removed in the future. [#2023](https://github.com/MakieOrg/Makie.jl/pulls/2023).

- Add linestyle and default to extrema(z) for contour, remove bitrotten fillrange [#2008](https://github.com/MakieOrg/Makie.jl/pull/2008).

- Added `empty!(fig)` and changed `empty!(scene)` to remove all child plots without detaching windows [#1818](https://github.com/MakieOrg/Makie.jl/pull/1818).

- **Breaking** Cleaned up `Scene` type [#1192](https://github.com/MakieOrg/Makie.jl/pull/1192), [#1393](https://github.com/MakieOrg/Makie.jl/pull/1393). The `Scene()` constructor doesn’t create any axes or limits anymore. All keywords like `raw`, `show_axis` have been removed. A scene now always works like it did when using the deprecated `raw=true`. All the high level functionality like showing an axis and adding a 3d camera has been moved to `LScene`. See the new `Scene` tutorial for more info: [Scene tutorial · Makie](https://docs.makie.org/dev/tutorials/scenes/).

- Fixed issue where `pixelcam!` does not remove controls from other cameras [#1504](https://github.com/MakieOrg/Makie.jl/pull/1504).

- Depend on new GeometryBasics, which changes all the Vec/Point/Quaternion/RGB/RGBA - f0 aliases to just f. For example, `Vec2f0` is changed to `Vec2f`. Old aliases are still exported, but deprecated and will be removed in the next breaking release. For more details and an upgrade script, visit [GeometryBasics#97](https://github.com/JuliaGeometry/GeometryBasics.jl/pull/97).

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 14, 2024, 9:22am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/4 "2024-03-14T09:22:47Z")

</div>

> [@ufechner7](#):
>
> Depend on new GeometryBasics, which changes all the Vec/Point/Quaternion/RGB/RGBA - f0 aliases to just f. For example, `Vec2f0` is changed to `Vec2f`. Old aliases are still exported, but deprecated and will be removed in the next breaking release. For more details and an upgrade script, visit [GeometryBasics#97](https://github.com/JuliaGeometry/GeometryBasics.jl/pull/97).

that’s the one you were looking for

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 14, 2024, 10:03am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/5 "2024-03-14T10:03:00Z")

</div>

Next error:

```julia
ERROR: MethodError: no method matching update_cam!(::Makie.Scene, ::Vector{Float64}, ::Vector{Float64})

```

I could not find `update_cam!` in the list of depreciated methods. How do you adjust the camera nowadays?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 14, 2024, 10:05am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/6 "2024-03-14T10:05:13Z")

</div>

I think the function is still there given your error, maybe it has a different signature? Not sure, what methods does it suggest?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 14, 2024, 10:12am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/7 "2024-03-14T10:12:12Z")

</div>

This is what the documentation says:

```julia
For updating eyeposition, lookat and/or upvector update_cam!(scene, eyeposition, lookat, upvector = Vec3f(0,0,1)) is preferred.

```

The help says:

```julia
  update_cam!(scene::Scene, eyeposition, lookat, up = Vec3f(0, 0, 1))

  Updates the camera's controls to point to the specified location.

```

Stacktrace:

```julia

Closest candidates are:
  update_cam!(::Makie.Scene, ::Makie.OldCamera3D, ::Any, ::Any, ::Any)
   @ Makie ~/.julia/packages/Makie/VRavR/src/camera/old_camera3d.jl:365
  update_cam!(::Makie.Scene, ::Makie.OldCamera3D, ::Any, ::Any)
   @ Makie ~/.julia/packages/Makie/VRavR/src/camera/old_camera3d.jl:365
  update_cam!(::Makie.Scene, ::Makie.AbstractCamera, ::Any)
   @ Makie ~/.julia/packages/Makie/VRavR/src/scenes.jl:542
  ...

Stacktrace:
 [1] reset_view(cam::Makie.Camera3D, scene3D::Makie.LScene)
   @ KiteViewers ~/repos/KiteViewers.jl/src/common.jl:183
 [2] Viewer3D(show_kite::Bool, autolabel::String)
   @ KiteViewers ~/repos/KiteViewers.jl/src/viewer3D2.jl:182
 [3] Viewer3D()
   @ KiteViewers ~/repos/KiteViewers.jl/src/viewer3D2.jl:125
 [4] top-level scope
   @ REPL[2]:1

```

But why is then this code not working any more:

```julia
update_cam!(scene3D.scene, [-15.425113, -18.925116, 5.5], [-1.5, -5.0, 5.5])

```

?

See also: [API · Makie](https://docs.makie.org/stable/api/#update_cam)!  
Code: [KiteViewers.jl/src/common.jl at 675814210ea22e7b5fda600533053d8c8faed8b3 · aenarete/KiteViewers.jl · GitHub](https://github.com/aenarete/KiteViewers.jl/blob/675814210ea22e7b5fda600533053d8c8faed8b3/src/common.jl#L181C1-L183C4)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 14, 2024, 10:18am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/8 "2024-03-14T10:18:30Z")

</div>

The signature is `function update_cam!(scene::Scene, camera::Camera3D, eyeposition::VecTypes, lookat::VecTypes, up::VecTypes = camera.upvector[])` as I see it in the source code, and `VecTypes` is from GeometryBasics

> <https://github.com/JuliaGeometry/GeometryBasics.jl/blob/4885d07fa24204882d6eb4f93dd8ab29b6437beb/src/fixed_arrays.jl#L123>

So the function seems only to take tuples or SVectors, not normal vectors. It was probably forgotten to document that change as internally, Makie never uses normal vectors to mean 2d or 3d points/vecs.

`Vec3(-15.425113, -18.925116, 5.5)` etc. should work I think

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 14, 2024, 10:28am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/9 "2024-03-14T10:28:15Z")

</div>

Thank you, this works!

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 14, 2024, 10:34am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/10 "2024-03-14T10:34:42Z")

</div>

My next problem are these grayish grid lines:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/1/71e6aafcb65c5b17faee9b7fc77579a5717d35fa.png)

How can I get rid of them?

My code:

```julia
    fig = Figure(size=(840, 900), backgroundcolor=RGBf(0.7, 0.8, 1))
    scene = fig[1,1]
    scene3D = LScene(scene, scenekw=(show_axis=false, limits=Rect(-7,-10.0,0, 11,10,11), size=(800, 800)))

```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 14, 2024, 11:01am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/11 "2024-03-14T11:01:40Z")

</div>

That’s this one

> **Breaking** Cleaned up `Scene` type [#1192](https://github.com/MakieOrg/Makie.jl/pull/1192), [#1393](https://github.com/MakieOrg/Makie.jl/pull/1393). The `Scene()` constructor doesn’t create any axes or limits anymore. All keywords like `raw`, `show_axis` have been removed. A scene now always works like it did when using the deprecated `raw=true`. All the high level functionality like showing an axis and adding a 3d camera has been moved to `LScene`. See the new `Scene` tutorial for more info: [Scene tutorial · Makie](https://docs.makie.org/dev/tutorials/scenes/).

So I think `show_axis` doesn’t go under `scenekw` anymore.

---

<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:** [March 14, 2024, 11:05am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/12 "2024-03-14T11:05:20Z")

</div>

`show_axis` has become a “first class” attribute:

```julia
using GLMakie
fig = Figure(size=(840, 900), backgroundcolor=RGBf(0.7, 0.8, 1))
subfigure = fig[1,1]
scene3D = LScene(subfigure, show_axis=false, scenekw=(; limits=Rect(-7, -10.0, 0, 11, 10, 11), size=(800, 800)))

```

Admittedly, `LScene` is a mess and some of the oldest code in the Makie code base, and has been only half heartedly upgraded to fit into the newer system… It’s ripe for a refactor, but nobody has had time for it so far.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 14, 2024, 11:21am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/13 "2024-03-14T11:21:05Z")

</div>

Thanks, this worked.

Next issue: I want to print text at the lower left postion of the window, a status line.

This used to work:

> <https://github.com/aenarete/KiteViewers.jl/blob/a59e48649e1665ec23f8d256bd7179d7be1cbfe3/src/viewer3D2.jl#L145>

But it does not work any more. It uses now the origin of the 3D plot as zero position  
of the text. How can I print text based on the 2D position of the GLMakie window?

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

The text “Stopped” should be at the bottom left of the window and not move if I turn the camera view…

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 14, 2024, 11:31am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/14 "2024-03-14T11:31:47Z")

</div>

hm if it used to work then `scene` must have been a `Scene` with `camera = campixel!`, if it’s now 3d that doesn’t really make sense, I would think your 3d scene is only the one called `scene3D`

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 14, 2024, 11:34am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/15 "2024-03-14T11:34:36Z")

</div>

I mean, you can see the old and the new definition of `scene` in the code:

```julia
    # scene, layout = layoutscene(resolution = (840, 900), backgroundcolor = RGBf(0.7, 0.8, 1))
    # scene3D = LScene(scene, scenekw = (show_axis=false, limits = Rect(-7,-10.0,0, 11,10,11), resolution = (800, 800)), raw=false)
    # create_coordinate_system(scene3D)
    # cam = cameracontrols(scene3D.scene)

    fig = Figure(size=(840, 900), backgroundcolor=RGBf(0.7, 0.8, 1))
    scene = fig[1,1]
    scene3D = LScene(scene, show_axis=false, scenekw=(limits=Rect(-7,-10.0,0, 11,10,11), size=(800, 800)))

```

---

<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:** [March 14, 2024, 11:35am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/16 "2024-03-14T11:35:30Z")

</div>

```julia
f = Figure()
sub = f[1, 1]
scene = LScene(sub)
text!(scene, "status", position=Point2f0(20, 0), fontsize=20, align=(:left, :bottom), space=:pixel)

```

We do have the space keyword now, which you can also use with e.g. `relative`.  
See the docs:  
[https://docs.makie.org/stable/reference/plots/text/](https://docs.makie.org/stable/reference/plots/text/)  
The `space` keyword should be accepted by most plots these days.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 14, 2024, 11:37am UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/17 "2024-03-14T11:37:42Z")

</div>

> [@ufechner7](#):
>
> `scene = fig[1,1]`

That’s not right, `fig[1, 1]` is a `GridPosition` object and not a `Scene`. The call `text!(scene,...` must take some weird dispatch route by accident and end up putting the text in the `current_axis()` I think because it doesn’t recognize the first argument.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 14, 2024, 1:13pm UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/18 "2024-03-14T13:13:24Z")

</div>

OK, I found a way to create a status line at the bottom.

Next question:  
In the past I could use the line:

```julia
gl_screen = display(sceen)

```

to get a handle to the opengl screen, but this function does not exist any more (or is no longer exported). How can I achieve this now?

---

<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:** [March 14, 2024, 1:16pm UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/19 "2024-03-14T13:16:22Z")

</div>

screen = display(figure)

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 14, 2024, 8:15pm UTC](https://discourse.julialang.org/t/from-glmakie-v0-4-7-to-glmakie-v0-9-9/111607/20 "2024-03-14T20:15:26Z")

</div>

Finally everything works! About 12h of work for this update, but if you update only every 4 years that might be OK. Nevertheless looking forward for Makie 1.0 and less frequent breaking changes.  
The new version v0.3.0 is available from: [GitHub - aenarete/KiteViewers.jl: 3D viewer for airborne wind energy systems](https://github.com/aenarete/KiteViewers.jl)

Thanks a lot for the support of @sdanisch and @jules and @sijo ! 😀
