R: How to change the text of strips in R's lattice xyplot -
i trying use function histogram plot density of data. sample format of data follows:
library(lattice) index<-c(1,1,1,2,2,2,2) freq<-c(3,4,6,3,6,2,2) d<-data.frame(index,freq) histogram(~d$freq|d$index)
i want have index number printed strip text each histogram (i.e. in example, 1 , 2 on top of histograms respectively instead of printed d$index
), don't know of easy way (i know have use strip.custom()
possibly, , change var.name
properly, don't know how iterate on according index)
if change index variable factor supposed default behavior, i.e. printing shingle levels in strip:
library(lattice) index<-factor(c(1,1,1,2,2,2,2)) freq<-c(3,4,6,3,6,2,2) d<-data.frame(index,freq) histogram(~d$freq|d$index)
just fun can play style variable in strip.default:
histogram(~freq|index, data=d, strip = function(..., style){ strip.default(..., style = 4)} )
Comments
Post a Comment