panel.hextri {hextri} | R Documentation |
A lattice panel function for hexagonal binning with classes
Description
Displays a hexagonally-binned scatterplot with coloured subtriangles to indicate number of observations in each class. Uses the Sainte-Lague method to apportion counts to triangles, ensuring the counts round to exactly six triangles per hexagon.
Usage
panel.hextri(x, y, groups, subscripts, colours, nbins = 10, border = TRUE,
diffuse = FALSE, style = c("alpha", "size"), weights = NULL,
sorted=!diffuse, shape = 1, ...)
Arguments
x , y |
point coordinates for the subset being plotted |
groups |
A factor giving the class identity for all points (will be filled in automatically by |
subscripts |
Vector selecting the elements of |
colours |
Vector of colors (number, name, or hashtag format) giving the colours for each class |
nbins |
Number of bins along the x axis |
border |
If |
diffuse |
If |
style |
Represent data by hexagon size or by alpha-blending |
weights |
If not |
sorted |
Sort the triangles into a consistent order within each hex? |
shape |
Aspect ratio for each hex. |
... |
because you have to. |
Value
A panel
Author(s)
Thomas Lumley
See Also
hextri
is the base-graphics plot
Examples
library(lattice)
xx<-rnorm(1000)
yy<-rnorm(1000)
cc<-cut(xx*yy,c(-Inf,-.4,0,.4,Inf))
zz<-cut(xx+yy,c(-Inf,-1,0,1,Inf))
plot(xx,yy,col=(1:4)[cc])
xyplot(yy~xx|zz, panel=panel.hextri,groups=cc,colours=1:4,style="size",nbins=10)
data(airquality)
airquality$o3group<-with(airquality, cut(Ozone, c(0,18,60,Inf)))
xyplot(Temp~Solar.R|equal.count(Wind,4), groups=o3group, panel=panel.hextri,
data=na.omit(airquality),colours=c("royalblue","grey60","goldenrod"),
strip=strip.custom(var.name="Wind Speed"),xlab="Solar Radiation (langley)",
ylab="Temperature (F)")