[R] dropping empty panels in xyplot

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Wed May 20 19:10:29 CEST 2009

I note that someone asked for help a few weeks ago regarding the ability to
drop empty panels on an xyplot.

I did not see a reply to that inquiry so I am asking for assistance with
the same problem

To prepare the data for the plotting routine, I did the following to
restrict the content of the data object to specific colonies of interest.

>  Colony_HSI.df <- Colony_HSI[Colony_HSI$Colony == "NE Grossman A" |
Colony_HSI$Colony == "Loop Road" | Colony_HSI$Colony == "Otter Creek" |
               Colony_HSI$Colony == "Upper Taylor Slough" |
Colony_HSI$Colony == "Tamiami West" ,]

xyplot(Colony_HSI$MEAN + Colony_HSI$TotalNests ~ Colony_HSI$Year |
Colony_HSI$Colony,  lty=c(1,2), pch=c(1,9),
          par.settings = graph.sets, type = "o",  xlab= "Year",
           ylab="Mean HSI",  drop.unused.levels =

However this produces a plot with 22 panels, but only 5 have data in them.
Am I using the subsetting routines incorrectly? Why are there "place
holders" in the data object even after I selected for just 5 of them? How
can I build the plot including  just the 5 colony names?


Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Steve_Friedman at nps.gov
Office (305) 224 - 4282
Fax     (305) 224 - 4147

More information about the R-help mailing list