ggplot 标签中字母 "g" 和 "y" 等 hidden/cut off/overwritten 的下尾部

Lower trailing parts of letters "g" and "y" etc hidden/cut off/overwritten in ggplot labels

"y" 和 "g" 的底部在这张地图中被切掉了。请参阅大豆下的 "dryland" 和 "irrigated"。

什么设置控制这个?这是我的 theme_map 函数

theme_map <- function (base_size = 12, base_family = "") {
  theme_gray(base_size = base_size, base_family = base_family) %+replace% 
    theme(
      axis.line=element_blank(),
      axis.text.x=element_blank(),
      axis.text.y=element_blank(),
      axis.ticks=element_blank(),
      axis.ticks.length=unit(0.3, "lines"),
      axis.ticks.margin=unit(0.5, "lines"),
      axis.title.x=element_blank(),
      axis.title.y=element_blank(),
      legend.background=element_rect(fill="white", colour=NA),
      legend.key=element_rect(colour="white"),
      legend.key.size=unit(1.2, "lines"),
      legend.position="right",
      legend.text=element_text(size=rel(0.8)),
      legend.title=element_text(size=rel(0.8), face="bold", hjust=0),
      panel.background=element_blank(),
      panel.border=element_blank(),
      panel.grid.major=element_blank(),
      panel.grid.minor=element_blank(),
      panel.spacing=unit(0, "lines"),
      plot.background=element_blank(),
      plot.margin=unit(c(1, 1, 0.5, 0.5), "lines"),
      plot.title=element_text(size=rel(1.2)),
      strip.background=element_rect(fill="white", colour="white"),
      strip.text.x=element_text(size=rel(.8)),
      strip.text.y=element_text(size=rel(0.8), angle=-90) 
    )   
}

作为一个脾气暴躁的基础图形爱好者,我花了很长时间才开始接触 ggplot2。我在网上的某个地方发现了 theme_map 函数,所以我还不明白。谁能告诉我需要调整哪些设置才能解决我的问题?

这是我生成这些地图(其中之一)的代码,但我假设相关部分在 theme_map 函数中

mapcorn <- ggplot(USA_fort_premade) + 
    aes(long,lat,group=group) + 
    geom_polygon(aes(x=long,y=lat, group=group, fill=yield.mean), 
                 data=REAP_fort_corn)+
    geom_path(color="grey", lwd = .1) +
    coord_fixed(1.3) +
    facet_wrap( ~ irr) +
    scale_fill_gradient2(low = rgb(.9, .4, 0), mid = rgb(.9, .9, 0),
                         high = rgb(0,.8,0), midpoint = mean(REAP_fort_corn$yield.mean, na.rm = TRUE), 
                         space = "Lab", name = "bu/ac",
                         na.value = "grey50", guide = "colourbar") +
    theme_map() +ggtitle("Corn")

抱歉无法重现,但数据量很大,这应该是一个相当简单的问题。 google 很难,但是如果您不知道这些条款。

如果这些是小平面条标签,请尝试 strip.text.x=element_text(margin=margin(b=5)),其中 b 是以磅为单位的底部边距。将它设置为任何大到足以显示完整文本的值。您可以使用 margin=margin(t=5, r=2, b=7, l=2) 或任何适用于您的图的值来调整顶部、右侧、底部和左侧的边距。