[R] bwplot puts the bars in the wrong place

James Rome jamesrome at gmail.com
Sat Apr 17 21:00:10 CEST 2010


David,

I did post a solved message:
        hrs = seq(0, 23, 1)             
        hrlabs = as.character(seq(0,23,1))   
        g = xyplot(gdf$tt~gdf$OnHour |gdf$Runway, data=gdf, ylab="Taxi
time (min)", main=title, xlab="Hour of day",
            xlim=c(-1, 24), scales=list(x = list(rot=90, cex=.6,
alternating=c(3,3,3,3),
            at=hrs, labels=hrlabs
            )),                                   
            panel=function(x, ...) {
                panel.grid(h = -1, v = 24)
                panel.bwplot(x, horizontal=FALSE, col="black",...)   
                               
            }
        )
        print(g)                                                   
created the plot I sent you (withxyplot.png), with the 0 data plotted on
zero, and the 3AM data blank.

I arrived at this by doing xyplot and observing that the points were
plotted correctly. Then I added panel.bwplot() and it was still correct,
so I removed panel.xyplot() and it worked. But replacing the main call
to xyplot with bwplot gets it wrong.
For example, I did it with
                          
        hrs = seq(0, 23, 1)            
        hrlabs = as.character(seq(0,23,1))  
        g = bwplot(gdf$tt~gdf$OnHFact |gdf$Runway, data=gdf, ylab="Taxi
time (min)", main=title, xlab="Hour of day",
            xlim=c(-1, 24), horizontal=FALSE, drop.unused.levels=FALSE,
            scales=list(x = list(rot=90, cex=.6, alternating=c(3,3,3,3),
            at=hrs, labels=hrlabs
            )),                                  
            panel=function(x, ...) {
                panel.grid(h = -1, v = 24)
                panel.bwplot(x, 
col="black",...)                                  
            }
        )
        print(g)                                                  
and get the attached withbwplotAndFactors.png, which is wrong. It was
also wrong with OnHour, and with drop.unused.levels=TRUE.

And I did indeed get errors if I left the gdf$ out of the formulas,
because it is defined in many data frames.

Thanks,
Jim

On 4/17/2010 12:35 PM, David Winsemius wrote:
On Apr 17, 2010, at 12:29 PM, James Rome wrote:

> It has all the data needed, and only that data, which I got dinged on
> before.

I was seeing a different number of points in some panels in your plot
compared to my plot. I have not downloaded the most recent dataset, and
from what you are saying here should  I assume it had not changed? But
your plot had a title that could not have been created by the posted
code , so i just don't know where you are with all of this. Are you
going to post a SOLVED message when it is finally answered?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: withbwplotAndFactors.PNG
Type: image/png
Size: 52267 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100417/a43faeeb/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: withxyplot.PNG
Type: image/png
Size: 52179 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100417/a43faeeb/attachment-0001.png>


More information about the R-help mailing list