[R] Scaling x axis

Gerrit Draisma gdraisma at xs4all.nl
Fri Feb 26 12:52:42 CET 2016


Ha Fabio,
With lattice' xyplot you can do
-----
library(lattice)
x<-as.Date(rnorm(10)*10,origin="2016-1-1")
y<-5+rnorm(10)
xyplot(y~x,type="h",scales=list(x=list(at=x,rot=90)))
-----

And yes, labels may overlap, even with rotation.

Gerrit.

> Message: 5
> Date: Thu, 25 Feb 2016 12:31:00 +0000
> From: Fabio Monteiro <fabio.monteiro1992 at gmail.com>
> To: r-help at r-project.org
> Subject: [R] Scaling x axis
> Message-ID:
> 	<CAG0T74qTJR0W-swm56Uxf3uHiWnxk8LB=4DfrzTpXnU8T6yksw at mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> Hi
>
> i'm trying to plot my data in R and i can't manage to scale the x axis.
>
> My x axis are dates, months and years, and when I plot I only have the x
> axis like this (2002, 2004, 2006, 2008, 2010).
>
> I whant every date in the axis not only those years, i want to see every
> point with the respectively date in the axis.
>
> How can I do that?
>
> Kind regards
>
> F?bio monteiro
>
> 	[[alternative HTML version deleted]]
>
>
>
> ------------------------------



More information about the R-help mailing list