I would like to get the geom_rug
below the x-axis (outside the plot) in the following example:
set.seed(1)
Time = seq( as.Date('2010-10-01'),as.Date('2010-11-01'),'2 day' )
Var1 = sample (length(Time))
Var2 = sample (length(Time))
tibble(Time, Var1, Var2) %>%
tidyr::gather(variable, value, -Time) %>%
ggplot(aes(x = Time, y = value)) +
geom_point() +
geom_rug(sides = 'b') +
theme_bw() +
facet_grid(variable ~ ., scales = 'free')
This has become a feature in the most recent version of ggplot2 3.2.0 as shown on this page https://ggplot2.tidyverse.org/reference/geom_rug.html , this is done using:
# increase the line length and
# expand axis to avoid overplotting
p + geom_rug(length = unit(0.05, "npc")) +
scale_y_continuous(expand = c(0.1, 0.1))
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.