Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Does anyone know if its possible to map to hexagon size with ggplot? Size is listed as an argument in the geom_hex documentation, but there are no examples of size mapping in stat_hexbin, so this just seems to relate to bin size.

Take for example:

ggplot(economics, aes(x=uempmed, y=unemploy)) + geom_hex()

enter image description here

But looking for instance at population distribution (below) it might be useful to map binned mean population to hexagon size, but I've not found a formula for this (if one exists).

ggplot(economics, aes(x=uempmed, y=unemploy, col=pop)) + geom_point()

enter image description here

Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
432 views
Welcome To Ask or Share your Answers For Others

1 Answer

Apparently the official answer is that ggplot does not have functionality to map to hexagon area. But as you can see a workaround solution is possible, now posted in a gist at github.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...