The bottom parts of the "y"'s and "g"'s are cut off in this map. See "dryland" and "irrigated" under soy.
What setting controls this? Here is my theme_map function
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)
)
}
I am just dipping my toe into ggplot2 after spending a long time as a curmudgeonly devotee of base graphics. I found that theme_map function on the internet somewhere, so I don't understand it yet. Can someone please tell me which of those settings I'd need to tweak to solve my problem?
Here's my code for generating (one of) those maps, but I'm assuming that the relevant part is in the theme_map function
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")
Apologies for not reproducible, but the data is huge and this should be a fairly simple question. A hard one to google however if you don't know the terms.
