I am making a series of bar plot graphs in ggplot and for some reason am generating a space underneath the bottom part of the bar plots and the x-axis (see photo). Anyone got any ideas how to remove them? I've tried setting ylim() (R doesn't like that), as well as using limits=c() within scale_y_continuous() to no effect. Thanks for any insight!
Code below (changed the variable names slightly since the report I'm working on is still in progress):
ggplot(scd, aes(x=reorder(jurisdiction, - yvar), y=yvar)) +
geom_bar(stat="identity",fill = "steelblue") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), plot.title = element_text(hjust = 0.5),
panel.background = element_rect(fill = "transparent"),
plot.background = element_rect(fill = "transparent", color = NA),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_rect(colour="black",fill=NA)) +
labs(title = "Graph Example") +
xlab("") +
ylab("Y-Axis") +
scale_y_continuous(labels = c("0%","2%","4%","6%","8%","10%","12%","14%","16%","18%"), breaks=c(0,2,4,6,8,10,12,14,16,18))