I would like to keep both x axes (bottom and top), while removing the panel border (or both y axes, left and right).
Code:
library(ggplot2)
p1 <- ggplot(mtcars, aes(mpg, disp)) + geom_line(colour = "blue") +
theme_bw() +
theme(axis.title.y=element_blank(),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
panel.border = element_blank(),
axis.line.x = element_line(size = 0.5, linetype = "solid", colour = "lightgrey"),
axis.line.y = element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.x = element_blank(),
panel.background = element_blank())
print(p1)