Unable to add multiple plots to a single scene in Makie

I am new to Makie and Julia in VSCode and I am trying to plot two plots in one scene. My code is

using Makie, GLMakie


x = rand(100)
y = rand(100)
z = rand(100)

scene = scatter(x, y, color=:forestgreen, markersize=7.5)
scene = scatter!(y, z, color=:crimson, markersize=7.5)

The first time (when I call scatter) my code evaluates to a FigureAxisPlot() and I get a plot on the side. But the second time (when I call scatter!) my code evaluates to a Scatter{Tuple{Vector{Point{2, Float32}}}} and the plot doesn’t change and a new plot is not created. I am following the Julia for the Talented Amateur series, and this code seems to work for them. I’m not sure how to fix it.

I am running Julia 1.8 on a Mac in VSCode and I ran up in the pkg> prompt so I believe all the packages are updated to the latest versions.

Check out the basic tutorial in the docs :slight_smile: Basic Tutorial

Scene used to be the return value of plotting functions quite a long time ago, I assume the tutorial you followed was made in that era.

Oh okay, thank you! The tutorial was from Nov 2020 so I didn’t think things could change that fast, but it is good to know.

I quickly checked and we released this in January 2021 [ANN] Makie Update: Figures And Integrated Layouts

Two years is a long time for us :slight_smile: Obviously not a lot in terms of absolute time, but many many things changed in this package along the way. I know it’s annoying to find outdated teaching material, but often these breaking changes were just very necessary so we don’t get stuck with old bad patterns.

1 Like

Yeah definitely, after spending the last 5 hours on tutorials I definitely appreciate the change!