[R] lattice question
Deepayan Sarkar
deepayan at stat.wisc.edu
Fri Aug 29 22:41:13 CEST 2003
The typical graphical representation for shingles is via plot.shingle, e.g.
a <- equal.count(rnorm(100))
plot(a)
I'm not sure how you wish to represent this information inside the histogram
plot itself, but everything you need should be available inside the strip
function. For example,
#################
x <- rnorm(100)
a <- equal.count(rnorm(100))
histogram( ~ x | a, par.strip.text = list(lines = 2),
strip = function(..., shingle.intervals,
which.given, which.panel, strip.names) {
print(shingle.intervals[which.panel[which.given], ,drop = TRUE])
strip.default(...,
shingle.intervals = shingle.intervals,
which.given = which.given,
which.panel = which.panel,
strip.names = FALSE)
ltext(.5, .5,
paste(round(shingle.intervals[which.panel[which.given], ,
drop = TRUE],
digits = 4), collapse = ", "))
})
################
The width of the strip area is determined by the display, but you can control
the height with par.strip.text. (Currently, whatever the strip function does
is clipped to within the strip area, you can override that with a setting
option in the lattice version that comes with r-devel)
Deepayan
On Friday 29 August 2003 14:37, Murad Nayal wrote:
> Hello,
>
> I am using lattice to plot histograms of one variable conditioned on
> another continuous variable. for this I am using equal.count on the
> conditioning variable to get the appropriate shingle. I would like to
> have in my plot a representation of the shingle's intervals including
> the min/max values and maybe tick marks. some sort of axis for the
> conditioning variable. while the 'strips' of the lattice plot do
> represent the single intervals as a darkly shaded region. I can't find a
> way to also include in the plot the actual min/max numbers corresponding
> to the shingle's intervals. is that possible?
>
> regards
More information about the R-help
mailing list