2

I have three graphs that I generated in ggplot2, and I want them to be laid out in the two-column format (as shown in the picture). However, I would like to center the bottom graph so that it is in the middle of the bottom row and not directly under the top left graph. How can I do this?

Code:

#dataset
data <- data.frame(a = c(1,4,5,6,7,8), b = c(3,2,1,5,4,3))

#Open packages
library(ggplot2)
library(gridExtra)

#Generate graphs
p1 <- ggplot(data, aes(x = a, y = b))+
  geom_point(size = 3, shape = 19)

p2 <- ggplot(data, aes(x = a, y = b))+
  geom_point(size = 3, shape = 19)

p3 <- ggplot(data, aes(x = a, y = b))+
  geom_point(size = 3, shape = 19)

#Arrange graphs using grid.arrange
grid.arrange(p1, p2, p3, ncol = 2)

The resulting image is here:

enter image description here

How can I move the bottom graph to the center of the row?

Community
  • 1
  • 1
ihb
  • 292
  • 9
  • 27

0 Answers0