On 6/8/07, Tom.O <[EMAIL PROTECTED]> wrote: > > Hi > I have a timeSeries object (X) with monthly returns. I want to display the > returns with a barplot, which I can fix easily. But my problem is labaling > the x-axis, if I use the positions from the timeseries It gets very messy. I > have tried rotating and changing the font size but it doesn't do the trick. > I think the optimal solution for my purpose is too only display every second > or third date, pherhaps only use every 12 month. But how do I do that?
It's quite easy to do that with ggplot2, see below, or http://had.co.nz/ggplot2/scale_date.html for examples. df <- data.frame( date = seq(Sys.Date(), len=100, by="1 day")[sample(100, 50)], price = runif(50) ) qplot(date, price, data=df, geom="line") qplot(date, price, data=df, geom="bar", stat="identity") qplot(date, price, data=df, geom="bar", stat="identity") + scale_x_date(major="2 months") qplot(date, price, data=df, geom="bar", stat="identity") + scale_x_date(major="10 day", format="%d-%m") qplot(date, price, data=df, geom="bar", stat="identity") + scale_x_date(major="5 day", format="%d-%m") Hadley ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
