[R] Lattice xyplot with two y axis

Dieter Menne dieter.menne at menne-biomed.de
Tue Apr 14 18:20:54 CEST 2009


taz9 <alienz747 <at> gmail.com> writes:

> I have some data which needs to be plotted with lattice.
> 
> library(lattice)
> cars <- c(0.1, 0.3, 0.6, 0.4, 0.9)
> trucks <- c(0.2, 0.5, 0.4, 0.5, 0.1)
> drivers<-c(121,145,167,200, 210)
> year<-c(2005,2006,2007,2008,2009)
> type<-c("local","local","foreign","foreign","foreign")
> xyplot(cars+trucks~year|type, data=df3, type="o")
> 
> Basically, I need to show "drivers" as well on a secondary y-axis. Is this
> possible with lattice and xyplot?
> 

Ugly, therefore not officially supported, but possible:

http://markmail.org/message/zap4t22er3aoqhcz

Omit the data=df3 in your example, otherwise it does not run.

Dieter




More information about the R-help mailing list