- edited description
geom_tri_tern fails to include some cases
I cannot get geom_tri_tern
to count all my cases. It seems that some extreme values are not included in the counts.
EDIT: after some more checking it seems that points on bins' boundaries are excluded from the count.
I’m using version 3.4.1
If I run the code snippet below, only one of three points are included in the counts shown by the geom_tri_tern
layer.
df = data.frame(x = c(0, 80, 50),
y = c(0, 20, 50),
z = c(100, 0, 0))
ggtern(df, aes(x, y, z)) +
geom_tri_tern(bins = 5, aes(fill = after_stat(count))) +
geom_point(size = 5)
Comments (4)
-
reporter -
reporter - edited description
-
reporter - edited description
-
repo owner Without running the code myself (its 3am here, I’ll investigate tomorrow), from recollection, I think it is because the point is sitting on the junction of several regions, and therefore contributes only 1/3 (or perhaps 1/6th if in the middle) of a point count for each surrounding triangle.
Try duplicating the point, by 3x (or 6), ie, in your frame, ie, replicate the offending point multiple times, to test my above hypothesis.
- Log in to comment