ggplot2 scale_y_log10 不适用于堆叠 geom_histogram
ggplot2 scale_y_log10 not working with stacked geom_histogram
structure(list(Hypothesis = c("H0", "H0", "H0", "H0", "H0", "H0",
"H0", "H0", "H0", "H0", "H0", "H0", "H0", "H0", "H0", "H0", "H0",
"H0", "H0", "H0", "H0", "H0", "H0", "H1", "H1", "H1", "H1", "H1",
"H1", "H1"), PP = c(9.26073693450588e-29, 3.34281982011265e-24,
9.38662550316043e-15, 7.95890908425815e-06, 2.86082492381069e-28,
2.20405950836506e-13, 9.0925912086661e-35, 2.31002748754231e-42,
4.76347929684044e-23, 1.38383109879787e-23, 2.86033450403371e-19,
1.18097638779878e-220, 1.10136930662603e-20, 3.34955010022165e-17,
1.12279490220994e-28, 3.58934964238325e-21, 4.82006911711899e-21,
2.3176322957431e-273, 3.65469210312312e-23, 1.035293515573e-60,
1.03909796125627e-46, 0, 1.72578715346419e-21, 0.096735363503543,
3.97631648427947e-16, 0.00403790620239148, 0.235149734366432,
0.298832898846241, 0.0948134291565298, 0.160951055566603)), row.names = c(NA,
30L), class = "data.frame")
我正在尝试用 `:
绘制直方图
p<-ggplot(t,aes(x=PP,fill=Hypothesis))+
geom_histogram(binwidth = 0.01)
p
如果我使用 scale_y_log10()
Y 轴上的值会变大而不是对数缩放
p<-ggplot(t,aes(x=PP,fill=Hypothesis))+
geom_histogram(binwidth = 0.01)+
scale_y_log10()
知道为什么 PP = 0 的计数变高了吗?
我们可以使用position= 'dodge'
library(ggplot2)
p <- ggplot(t, aes(x = PP, fill = Hypothesis))+
geom_histogram(binwidth = 0.01, position = 'dodge')+
scale_y_log10()
structure(list(Hypothesis = c("H0", "H0", "H0", "H0", "H0", "H0",
"H0", "H0", "H0", "H0", "H0", "H0", "H0", "H0", "H0", "H0", "H0",
"H0", "H0", "H0", "H0", "H0", "H0", "H1", "H1", "H1", "H1", "H1",
"H1", "H1"), PP = c(9.26073693450588e-29, 3.34281982011265e-24,
9.38662550316043e-15, 7.95890908425815e-06, 2.86082492381069e-28,
2.20405950836506e-13, 9.0925912086661e-35, 2.31002748754231e-42,
4.76347929684044e-23, 1.38383109879787e-23, 2.86033450403371e-19,
1.18097638779878e-220, 1.10136930662603e-20, 3.34955010022165e-17,
1.12279490220994e-28, 3.58934964238325e-21, 4.82006911711899e-21,
2.3176322957431e-273, 3.65469210312312e-23, 1.035293515573e-60,
1.03909796125627e-46, 0, 1.72578715346419e-21, 0.096735363503543,
3.97631648427947e-16, 0.00403790620239148, 0.235149734366432,
0.298832898846241, 0.0948134291565298, 0.160951055566603)), row.names = c(NA,
30L), class = "data.frame")
我正在尝试用 `:
绘制直方图p<-ggplot(t,aes(x=PP,fill=Hypothesis))+
geom_histogram(binwidth = 0.01)
p
如果我使用 scale_y_log10()
Y 轴上的值会变大而不是对数缩放
p<-ggplot(t,aes(x=PP,fill=Hypothesis))+
geom_histogram(binwidth = 0.01)+
scale_y_log10()
知道为什么 PP = 0 的计数变高了吗?
我们可以使用position= 'dodge'
library(ggplot2)
p <- ggplot(t, aes(x = PP, fill = Hypothesis))+
geom_histogram(binwidth = 0.01, position = 'dodge')+
scale_y_log10()