from plotnine import ggplot, aes, geom_point, geom_boxplot, theme, element_rect
from plotnine.composition import plot_spacer
from plotnine.data import mtcars
= ggplot(mtcars, aes("wt", "mpg")) + geom_point()
p1 = ggplot(mtcars, aes("wt", "disp")) + geom_point()
p2 = ggplot(mtcars, aes("factor(cyl)", "wt")) + geom_boxplot()
p3
| plot_spacer() | p2 p1
| (p2 / plot_spacer() / p3) p1
Change the color of the space.
| plot_spacer("#FF000022") | p2 p1
Which is the same as
| (plot_spacer() + theme(plot_background=element_rect(fill="#FF000022"))) | p2 p1