From ?scale_x_discrete
:
You can use continuous positions even with a discrete position scale - this allows you (eg) to place labels between bars in a bar chart.
You can add vertical lines with geom_vline()
& set the position at 1.5, 2.5, etc:
ggplot(mpg, aes(drv, hwy)) +
geom_boxplot(aes(colour = drv))+
geom_vline(xintercept = c(1.5, 2.5), linetype = "dashed") +
facet_wrap(~ year) +
theme_bw() +
theme(panel.grid=element_blank())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.