Hi, I'm having a bit of trouble with 'scales="free"' in the segplot() function of latticeExtra. Say we need panels for each year, showing only those counties that are represented in each one:
---<--------------------cut here---------------start------------------->--- library(latticeExtra) data(USCancerRates) uscr.w <- subset(USCancerRates, state == "Washington") uscr.w$year <- gl(4, 10, length=nrow(uscr.w), labels=format(seq(2001, 2004))) segplot(reorder(factor(county), rate.male) ~ LCL95.male + UCL95.male | year, data=uscr.w, scales="free") ---<--------------------cut here---------------end--------------------->--- This still plots all levels of county in every panel. Based on a similar need for dotplot in another thread, the following looked promising, but gives empty panels: ---<--------------------cut here---------------start------------------->--- segplot(reorder(factor(county), rate.male) ~ LCL95.male + UCL95.male | year, data=uscr.w, scales="free", prepanel=function(x, y, z, ...) { zz <- z[, drop=TRUE] list(sort(unique(zz))) }, panel=function(x, y, z, ...) { zz <- z[, drop=TRUE] panel.segplot(x, y, zz, ...) }) ---<--------------------cut here---------------end--------------------->--- Is it possible to have only counties for the particular panel (year) in these plots? Thanks. Cheers, -- Seb ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.