2
我有以下示例數據集:R:誤差線未在ggplot印刷對數標度
Sample,Zeitpunkt,Target,NRQ,SD
"Ctrl","42wk","Ccl12",0.02288218,0.02693519
我需要使用對數y縮放。 MWE看起來如下:
library("ggplot2")
Cc <- ggplot(test, aes(x=Sample, y=NRQ, fill=Zeitpunkt, ymin=NRQ-SD, ymax=NRQ+SD))
Cc <- Cc + geom_bar(stat="identity", position="dodge")
Cc <- Cc + scale_y_log10(breaks=c(0.01,0.1,1,10,100), limits=c(0.00001,200))
Cc <- Cc + annotation_logticks(base = 10, sides="l")
Cc <- Cc + guides(fill = guide_legend(keywidth = 0.6, keyheight = 0.6))
Cc <- Cc + geom_errorbar(linetype=1, size=0.5, width=0, position=position_dodge(0.9))
哪應該產生誤差線。但事實並非如此:
什麼我們迄今發現的是:
- 如果誤差值大於平均值(在這個例子中
0.02288218 < 0.02693519
大出現的錯誤 。
- 它如果errorbars均創下情節的限制也出現。
的dodge
命令包含因爲我們需要它包含更多數據的實際情節,所以將它包括在內會很好。 有沒有一種方法來繪製這種情節中的誤差線?
非常感謝!