Multiple plots: some refinements

Is it possible to set Computer Modern as the legend font, to keep the fonts consistent?

Can you try ]up so that you get GridLayoutBase.jl v.0.5.7? It should work now:

f = Figure(font = "NewCM10-Regular.otf")
ls = []
for i in 1:4
    for j in 1:i
        ax = Axis(f[i, j], width = 100, height = 100, ylabel = "y label")
        push!(ls, lines!(ax, 0..10, sin, color = rand(RGBf0)))
        if i == j && j > 1
            ax.yaxisposition = :right
            if j < 4
                ax.alignmode = Mixed(right = MakieLayout.Protrusion(0))
            end
        elseif j > 1
            hideydecorations!(ax, grid = false)
        end
        if i < 4
            hidexdecorations!(ax, grid = false)
        end
    end
end
Legend(f[1, 4], ls, string.(1:10), halign = :right, valign = :top,
    tellwidth = false, nbanks = 3)
resize!(f.scene, f.layout.layoutobservables.reportedsize[]...)
save("test.pdf", f)

@leandromartinez98 as you can see, you can use a computer-modern like font for everything (for some reason in this case it only worked when giving the full path, though)

3 Likes

And…here we are!


The subplots size is exactly the one I wanted. The subplots are near, as I wanted. I have used LaTeX almost everywhere. This is great!
Now I need to write the code a bit better before posting, @liuyxpp . Furthermore, I have to understand why I cannot set NewCM10-Regular.otf as the legend font, but this is probably an issue related to my self. Thank you again @jules !

1 Like

Yeah you have to have the font file that I used of course :wink: Just wanted to show there’s no magic to it

1 Like

It was easy, in the end…and here the final result!


Hopefully tomorrow I’ll write the code in a better way, such that I can post it @liuyxpp :wink:

4 Likes