Hi everybody,
We’ve got another Makie update for you! This one includes one big change and a couple smaller ones. Although we’ve tagged breaking releases across the board, the effort on your side to update your code should be minimal. Thanks to @sdanisch @ffreyer and @piever for their work on this and AlgebraOfGraphics, that makes use of some of the new features in its upcoming version.
Here’s a quick rundown of the biggest changes:
AbstractPlotting renamed to Makie
Many people were rightly confused that we advised actively against installing Makie.jl
in the last months. The reason was that years ago, there was only the GLMakie backend, the AbstractPlotting infrastructure package, and the Makie.jl package tying those two components up for convenience.
With CairoMakie and WGLMakie maturing, it doesn’t make sense anymore to bundle GLMakie and AbstractPlotting under the main Makie.jl name. Therefore, we have decided to rename AbstractPlotting.jl to Makie.jl. AbstractPlotting is effectively obsolete. There is no more bundle package, all backends should be installed directly. You still don’t have to install Makie.jl
explicitly because it comes as a dependency of each backend anyway.
To update your code, it should be enough to search and replace AbstractPlotting
with Makie
.
Centered heatmaps
Heatmaps are now by default centered on the x and y values passed in. Before, the endpoints of x and y would specify the edges of the heatmap.
heatmap(randn(5, 5), axis = (aspect = 1,))
Irregular heatmaps
The centering change goes together with the new option to plot irregular heatmaps, where the bins are of different rectangular sizes.
heatmap(sqrt.(0:10:100), sqrt.(0:10:100), randn(11, 11),
axis = (title = "Irregular heatmap", aspect = 1,))
Fixed arrows
Arrows used to work a bit unreliably across CairoMakie and GLMakie. Now, you have data independent arrow tip sizes by default which looks much more polished.
f = Figure(resolution = (700, 700))
Axis(f[1, 1], backgroundcolor = "black")
xs = LinRange(0, 2pi, 20)
ys = LinRange(0, 3pi, 20)
us = [sin(x) * cos(y) for x in xs, y in ys]
vs = [-cos(x) * sin(y) for x in xs, y in ys]
strength = vec(sqrt.(us .^ 2 .+ vs .^ 2))
as = arrows!(xs, ys, us, vs, lengthscale = 0.3,
arrowcolor = strength, linecolor = strength)
f
Plot object theming
Before, you could not theme specific plot objects separately, this is now fixed. This allows you to set up much more elaborate themes. There are also a couple of changes in the default theme, and a couple of new global attributes, such as linecolor
, markercolor
, patchcolor
, linewidth
, markersize
, strokewidth
, strokecolor
, patchstrokewidth
, patchstrokecolor
. Many recipes inherit these values so you can change them in one place rather than for every recipe.
with_theme(Lines = (linewidth = 5, linestyle = :dash)) do
lines(cumsum(randn(50)))
end
Cycling
Plot attributes can now be cycled. This is by default enabled for color
for a lot of recipes, but can be themed separately. Cycling currently works with Axis and Axis3 only.
You can theme the palettes that cycling chooses from and theme which attributes should be cycled for each plot type. This allows for example to create a black-and-white theme in which lines don’t cycle colors but linestyles.
f = Figure()
ax1 = Axis(f[1, 1])
ax2 = Axis(f[2, 1], palette = (
color = [:red, :green, :blue, :cyan, :magenta, :orange],))
for ax in [ax1, ax2], i in 1:6
data = cumsum(randn(50))
lines!(ax, data)
scatter!(ax, data, markersize = 7)
end
f