When to use layoutable.attr = vs layoutable.attr[] =

using CairoMakie

f = Figure()

ax = Axis(f[1, 1])


markersizes = [5, 10, 15, ]
colors = [:red, :green, :blue, :orange]

for ms in markersizes, color in colors
    scatter!(randn(5, 2), markersize = ms, color = color)
end


ax.xticklabelsize[] = 20

f

When do I want layoutable.attr = _ vs layoutable.attr[] = _? In this case they seem to do the same thing, but maybe there are cases where they differ.

The first one is especially overloaded setproperty! syntax to make it easy to change attributes, in the second one you first getproperty the observable and then mutate it with like usual. They’re functionally equivalent.