Tribin (ggtern version).
Divides the plane into regular triangles, counts the number of cases in each triangles, and then (by default) maps the number of cases to the triangle fill.
geom_tri_tern(mapping = NULL, data = NULL, stat = "tri_tern", position = "identity", ..., fun = sum, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) stat_tri_tern(mapping = NULL, data = NULL, geom = "tri_tern", position = "identity", ..., bins = 30, fun = sum, centroid = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
fun |
the scalar function to use for the statistic |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
geom, stat |
Override the default connection between 'geom_hex_tern' and 'stat_hex_tern' |
bins |
numeric vector giving number of bins in both vertical and horizontal directions. Set to 30 by default. |
centroid |
logical to return the centroid of the polygon, rather than the complete polygon |
@section Aesthetics:
geom_hex()
understands the following aesthetics (required aesthetics are in bold):
x
y
alpha
colour
fill
group
linetype
size
Learn more about setting these aesthetics in vignette("ggplot2-specs")
.
set.seed(1) n = 1000 df = data.frame(x = runif(n), y = runif(n), z = runif(n), wt = runif(n)) #Equivalent of Hexbin ggtern(df,aes(x,y,z)) + geom_tri_tern(bins=10,aes(fill=..count..)) + geom_point(size=0.25) #Custom Function, Mean ggtern(df,aes(x,y,z)) + geom_tri_tern(bins=5,aes(fill=..stat..,value=wt),fun=mean) + geom_point(size=0.25)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.