[R] lattice barchart using a time scale in x axis

Fran Velasco franvgls at gmail.com
Fri Feb 5 19:27:22 CET 2010


Thanks a lot for your help, the examples worked fine, just have to 
change the colours to produce a b&w plot, and add the legend
On 05/02/2010 17:11, RICHARD M. HEIBERGER wrote:
> Fran,
>
> The trick is to use box.width, not box.ratio.
>
> xyplot(Perc ~ as.POSIXct(hora,format="%d-%m-%Y %H:%M"),
>         data=digrate, groups=Drate, ## key=leg,
>         xlab="time of the day",
>         horizontal=FALSE,
>          scales=list(alternating=FALSE,
>            tck=c(1,0),
>            x=list(at=seq(r[1],r[2],by="hour"),
>          labels=format(seq(r[1],r[2],"hours"), format="%H"))),
>         panel=function(...) {
>           panel.fill(col="white")
>           panel.grid(-1,0,lty=3,col="gray")
>           panel.barchart(...)
>         },
>        main="xyplot", box.width=5000
>        )
>
> I also changed the color of the grid to gray.  I don't want the background grid
> visually dominant.
>
> Rich
>
>



More information about the R-help mailing list