I am trying to build a stack of ggplot2 density plots, like so:
And I have lined up / limited the x-axes so that then these grpahs are stacked using the gridExtra package, the ticks line up perfectly. However, in doing so, what I thought was a solid x-axis marker before turns out be a bottom "marker" line at the bottom of the density plot:
Is there anyway to add back in some sort of x-axis? The plots look somewhat naked/empty without it. I understand it more clearly indicates the limits of the data, but it looks unfinished and broken.
Edit
Here is the code I am using:
g <- ggplot(df_L, aes(x=values, linetype= type)) +
geom_density() +
ggtitle(expression('Low Region: '~LI[i]~'and'~WI[i])) +
scale_x_continuous(breaks = c(seq(0,100,10)), expand = c(0,0)) +
scale_y_continuous(expand = c(0,0)) +
coord_cartesian(xlim = c(0,100)) +
theme(text = element_text(size=20),
plot.title = element_text(size=14, vjust=1.5, hjust=0.5),
axis.title.x=element_blank(),
axis.title.y = element_blank(),
legend.position = c(0.1, 0.75),
legend.text.align = 0,
legend.box = 'horizontal',
legend.margin = unit(45.0, 'line'),
legend.text=element_text(size=14,vjust=0,hjust=0),
legend.key.height = unit(1, 'line'),
legend.key.width = unit(1, 'line'),
panel.background = element_rect(fill = "white")) +
scale_linetype_manual(values=c(1,2,3),
labels=c(expression(LI[i]),expression(WI[i]))) +
guides(linetype = guide_legend(title=NULL))
g