Plot title with patchwork

Hi,

I wonder if there is a qay how to spread a plot tiltle across both ggplot_object_1 (g1 )and ggplot_object_2(g2) when I use patchwork as g1 + g2 so that the plot title would be in the centre of combined g1 and g2.

so not like this:
image

Maty thanks for your thoughts,

Jakub

Hi,
I just cite the Exapmle code in the manual of package"patchwork"(p7, plot annotation) and make adjustment. I am not sure it is what you want to achieve. Maybe you could ask question by providing a relevant REPRoducible EXample (reprex) . And then, maybe other people colud help you more. I am R beginner now.

library(patchwork)
library(ggplot2)
p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))
p3 <- ggplot(mtcars) + geom_bar(aes(gear)) + facet_wrap(~cyl)
# Add title, etc. to a patchwork
p1 + p2 + plot_annotation('This is a title', caption = 'made with patchwork',theme=theme(plot.title=element_text(hjust=0.5)))

Created on 2022-11-21 with reprex v2.0.2

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.