On Thu, Jul 8, 2010 at 12:42 PM, Gabor Grothendieck <ggrothendi...@gmail.com > wrote:
> On Thu, Jul 8, 2010 at 4:17 AM, Rainer M Krug <r.m.k...@gmail.com> wrote: > > Hi > > > > Let's assume, I have a dataset of 1000 datapoints, which represent daily > > recordings of a measurement. > > They are stored as a ts object (see example below) > > > > Now I want to represent them as a barplot. I found the barplot in the zoo > > package, but I have one problem: the x-axis labels. I would like to have > the > > x-axis labels as either years only (located at the beginning of the > year), > > or year/month. So my question: > > > > How can I set the x-axis labels to years > > > > I can change the start / end of the time series if necessary or use > another > > barplot. > > > > Below find a small example: > > > > library(zoo) > > x <- ts(runif(1000), start=c(2000, 150), frequency=365) > > barplot(zoo(x)) > > > > > > Try this: > > library(zoo) > plot(as.zoo(x), type = "h", xaxt = "n") > axis(1, unique(floor(time(x)))) > > or this: > > plot(x, type = "h", xaxt = "n") > axis(1, unique(floor(time(x)))) > Thanks a lot Gabor - works perfectly. Cheers, Rainer -- NEW GERMAN FAX NUMBER!!! Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Natural Sciences Building Office Suite 2039 Stellenbosch University Main Campus, Merriman Avenue Stellenbosch South Africa Cell: +27 - (0)83 9479 042 Fax: +27 - (0)86 516 2782 Fax: +49 - (0)321 2125 2244 email: rai...@krugs.de Skype: RMkrug Google: r.m.k...@gmail.com [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.