我正在使用 R 中的 ggplot2 為兩個名為 A 和 B 的物件繪制圖形。我的代碼是
ggplot(test_error_bar_14_10_21, aes(x=levels, y=len, colour=index, group=index))
geom_errorbar(aes(ymin=len-ci, ymax=len ci), width=.03)
geom_line()
geom_point(size=3, shape=21, fill="white") # 21 is filled circle
xlab("Percentage(%population)")
ylab("Treatment on new cases")
scale_colour_hue(name="Type of indices", # Legend label, use darker colors
breaks=c("doses/population", "death/population"),
labels=c("A", "B"),
l=40) # Use darker colors, lightness=40
ggtitle("The Effect of different vaccines rates on \nA and B")
coord_flip() #rotate the graph (https://ggplot2.tidyverse.org/reference/coord_flip.html)
expand_limits(y=0) # Expand y range
scale_y_continuous(breaks=0:20*4) # Set tick every 4
theme_bw()
theme(legend.justification=c(1,0),
legend.position=c(1,0)) # Position legend in bottom right
結果是

可以看出,我在 x 軸上的結果為負,那么我應該怎么做才能在 x 軸上標記負區間?我在
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/315822.html
