Hello everyone,
I was trying too create a specific layout of plots as per my needs and ran into a problem. I am using plot.jl with GR backend. My current custom plot layout looks like this:
However I want the last row of my layout to only occupy 50% of the total width and be center aligned. I couldn’t figure out a way to do this.
Any help would be appreciated. Thanks.
From memory, make the last row _{0.25w} c{0.5w} _{0.5w}
I didn’t manage to use @gustaphe’s elegant syntax but the brute force below works, FYI:
using Plots; gr()
l = @layout [grid(1,2){0.3h}; b{0.5h}; c{0.25w} d{0.5w} e]
p1 = p2 = heatmap(rand(100,20))
p3 = scatter(rand(10,2))
p5 = heatmap(rand(200,20), colorbar=nothing)
p4 = p6 = plot(frame=:none)
plot(p1,p2,p3,p4,p5,p6, layout=l)
Thanks for responding @gustaphe, I tried implementing your solution but I got this error:
“LoadError: When doing layout, n (6) != n_override (4). You’re probably trying to force existing plots into a layout that doesn’t fit them.”
Thanks that did the trick! Thanks for your help @rafael.guerra.
1 Like
Hm, I looked it up, and the last paragraph of Layouts · Plots suggests my memory is accurate. Someone should make an issue about that (Maybe it’s just that you can’t do the curlybrace thing yet, still a worthy feature request).
1 Like