Problems with titles, axes, grids and other plot properties using Makie

Here’s one way you could do it (I’ve used AbstractPlotting#master as well this time):

using AbstractPlotting.MakieLayout
using AbstractPlotting
using CairoMakie; CairoMakie.activate!()
using FileIO
using Colors

img = rotr90(Float64.(Gray.(load("coin.jpg")))) # for some reason makie needs rotated images (column / row-major storage etc.)


scene, layout = layoutscene(resolution = (800, 800))

topax = layout[1, 1:2] = LAxis(scene,
    title = "Target is 25.00 by 25.00 beam diameters (2.98mm by 2.98mm)",
    ylabel = "Feedrate (mm s-1)",
    xlabel = "Path distance (mm)")
lines!(topax, randn(250))

leftax = LAxis(scene,
    title = "RMS error = 1234",
    autolimitaspect = 1)
hm1 = heatmap!(leftax, img)
leftcb = LColorbar(scene, hm1, width = 20)

rightax = LAxis(scene,
    title = "Target depth range = 1234",
    autolimitaspect = 1)
hm2 = heatmap!(rightax, img)
rightcb = LColorbar(scene, hm2, width = 20)

hidedecorations!.([leftax, rightax])
hidespines!.([leftax, rightax])
tightlimits!.([leftax, rightax])

layout[2, 1] = hbox!(leftax, leftcb)
layout[2, 2] = hbox!(rightax, rightcb)

save("test.png", scene, px_per_unit = 2) # twice the resolution for exporting

3 Likes