我试图用geom_hex()绘制一些对数刻度数据,但我有alpha透明度设置的问题.
情节剧本;
p <- ggplot(data =test,aes(x=f.log, y=d.log)) +
geom_hex(aes(alpha=log(..count..)),fill="#000000")+
geom_hline(yintercept = 0, size = 0.5,color="red",linetype = 2) +
geom_vline(xintercept = 0, size = 0.5,color="red",linetype = 2) +
theme_bw()
Run Code Online (Sandbox Code Playgroud)
用于对数刻度标签校正;
p +scale_y_continuous(labels =(math_format(10^.x)))+
scale_x_continuous(labels =(math_format(10^.x)))
Run Code Online (Sandbox Code Playgroud)
Q1:如何修复图例标签和刻度?我使用"alpha = log(.. count ..)",我应该使用"alpha = .. count .."吗?
Q2:我怎样才能改变传奇的突破?"alpha = log(.. count ..)"看起来不错,但如果我必须使用"alpha = .. count ..",我需要手动定义中断.
所有数据集都有一个图表来显示中断问题;
geom_hex(aes(alpha=log..count..),fill="#000000")
Run Code Online (Sandbox Code Playgroud)
geom_hex(aes(alpha=log(..count..)),fill="#000000")
Run Code Online (Sandbox Code Playgroud)
谢谢,
数据样本;
test <- structure(list(
f.log = c(-0.253102353724454, -0.694948028330518,
-0.016322256625567, -0.0748410768849531, -0.306172135262068,
-0.163707542457202, -0.718554577089733, -0.225934877658866, -0.071806377990495,
-0.571575260001342, -0.0366094797226827, -0.576080377580693,
-0.746006267289661, -0.0489249923859604, -0.80387915691451, 0.133518827725897,
1.13432813432443, …Run Code Online (Sandbox Code Playgroud)