简体   繁体   中英

R ggplot2: possible to customize the continuity of a time scale?

Is it possible to have a datetime scale not consider weekends as part of the time continuum? For instance, if I am plotting stock prices over a 2 week period with a line geometry, I do not want to plot a 2 day period of flattness during the weekend. I would like friday to connect with Monday.

I imagine that there's a better way, but you could always just use an index for the plot and then assign the dates as labels afterwards:

p <- qplot(1:3, 1:3, geom='line') 
p + scale_x_continuous("", breaks=1:3, labels = as.Date(c("2010-06-03", "2010-06-04", "2010-06-07")))

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM