[R] xyplot with 2 panels and 2 different x-scales

taz9 alienz747 at gmail.com
Fri Jul 31 19:38:24 CEST 2009


I used the scales relation to obtain different x-scales for each panel.
However, there's a gap between the 2 panels. Any ideas on how I could remove
it?

xyplot(place~rank|type, data=df1, scales=(relation="free"),
panel= function(x, y, ..., subscripts) {
             panel.xyplot(x,y,..., subscripts)
             require(grid)
              panel.grid(h = -1,v = 0, lty="dotted")
              grid.text(unit(x,"native"),
                        unit(y,"native"),
                        label=x, just="center")
          
              })

http://www.nabble.com/file/p24760249/example2.png 



taz9 wrote:
> 
> Hi All,
> 
> I have this data:
> 
> type<-c("country","country","country","world","world","world")
> place<-c("A","B","C","A","B","C")
> rank<-c(1,3,5,512,420,320)
> df1<-data.frame(type,place,rank)
> 
> and need to produce an xyplot with 2 panels, where the x-values are
> labelled:
> 
> 
> xyplot(place~rank|type, data=df1,
> panel= function(x, y, ..., subscripts) 
> {
>              panel.xyplot(x,y,..., subscripts)
>              require(grid)
>               panel.grid(h = -1,v = 0, lty="dotted")
>               grid.text(unit(x,"native"),
>                         unit(y,"native"),
>                         label=x, just="center")
>           
> })
> 
> Now as you can see, the range of data is very different for the 2 panels.
> I'd like to have the x-scales be different in each panel to better
> visualize this data.
> 
>  http://www.nabble.com/file/p24760060/example1.png 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/xyplot-with-2-panels-and-2-different-x-scales-tp24760060p24760249.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list