R ggplot geom_hex alpha transparency

落爺英雄遲暮 提交于 2019-12-05 11:28:59

I am still not sure what you want, but I looked at the guides. I don't see a way to override how the guide values are printed out, similar to the way you modified the values in the axis. Anyway, this is what I got, using your data above:

p <- ggplot(data =test,aes(x=f.log, y=d.log)) +
  geom_hex(aes(fill="#000000",alpha=log(..count..)),fill="#0000ff")+
  geom_hline(yintercept = 0, size = 0.5,color="red",linetype = 2) +
  geom_vline(xintercept = 0, size = 0.5,color="red",linetype = 2) +
  guides(alpha=guide_legend(title="Log of Count",label=T))+
  theme_bw() +
  scale_y_continuous(labels = (math_format(10 ^ .x))) +
  scale_x_continuous(labels = (math_format(10 ^ .x)))

print(p)

Yielding this:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!