2
如何添加一個傳統的傳說來使用ggalt::geom_dumbbell
在R
創建的啞鈴情節?在`R`的`ggalt :: geom_dumbbell`中添加一個傳統的傳說來啞鈴情節
This question has an answer with in-chart legend。如何繪製美學圖像以獲得側面/底部的點的單獨圖例?
library(ggalt)
df <- data.frame(trt=LETTERS[1:5], l=c(20, 40, 10, 30, 50), r=c(70, 50, 30, 60, 80))
ggplot(df, aes(y=trt, x=l, xend=r)) +
geom_dumbbell(size=3, color="#e3e2e1",
colour_x = "red", colour_xend = "blue",
dot_guide=TRUE, dot_guide_size=0.25) +
theme_bw()
得到一個圖例
它更容易幫助你,如果你提供一個[重複的例子(https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible樣本)與樣本輸入數據。 – MrFlick
@MrFlick這個例子已經結束了。 – Crops
那麼從這個例子中,你想在圖例中做些什麼? – MrFlick