Gabby
Gabby

Reputation: 21

How do I get the left axis title to be closer to the ggmap plots arranged via Patchwork?

I have tried many ways to get the y-axis title of a patchwork collection of ggmaps to appear close to the axis but couldn't succeed. Instead I get something like this: Problematic output It is only reasonable to think there is a margin around the image. How do I get this title closer?

I want this output: Expected output I tried this:

library(grid)
library(gridtext)
yleft <- grid.text("Latitude (°N)", rot = 90, vjust = 0.50, gp = gpar(fontsize = 12, fontfamily = "serif"))
bottom <- grid.text("Longitude (°E)", hjust = 1.05, gp = gpar(fontsize = 12, fontfamily = "serif"))
{ wrap_elements(yleft) + 
    {{Pb1 + Pb2 + Pb3 + Pb4 + Pb5 + Pb6 + Pb7 + Pb8+ 
    plot_layout(guides='collect', ncol = 2)}} + 
 plot_layout(widths=c(1,20,1)) } / 
  bottom + 
  plot_layout(heights=c(100,1,1))

Upvotes: 0

Views: 14

Answers (0)

Related Questions