我需要能够在ggplot框图中显示平均值.以下是一点,但我需要白色的虚线?有人帮吗?
x
Team Value
A 10
B 5
C 29
D 35
ggplot(aes(x = Team , y = Value), data = x)
+ geom_boxplot (aes(fill=Team), alpha=.25, width=0.5, position = position_dodge(width = .9))
+ stat_summary(fun.y=mean, colour="red", geom="point")
Run Code Online (Sandbox Code Playgroud)
KLD*_*ort 10
这是我为箱线图添加均值的方法:
ggplot(RQA, aes(x = Type, y = engagementPercent)) +
geom_boxplot(aes(fill = Type),alpha = .6,size = 1) +
scale_fill_brewer(palette = "Set2") +
stat_summary(fun.y = "mean", geom = "text", label="----", size= 10, color= "white") +
ggtitle("Participation distribution by type") +
theme(axis.title.y=element_blank()) + theme(axis.title.x=element_blank())
Run Code Online (Sandbox Code Playgroud)

ggplot(df, aes(x = Type, y = scorepercent)) +
geom_boxplot(aes(fill = Type),alpha = .6,size = 1) +
scale_fill_brewer(palette = "Set2") +
stat_summary(fun.y = "mean", geom = "point", shape= 23, size= 3, fill= "white") +
ggtitle("score distribution by type") +
theme(axis.title.y=element_blank()) + theme(axis.title.x=element_blank())
Run Code Online (Sandbox Code Playgroud)

我会告诫不要使用文本来做geom_line,因为文本稍微偏移并给出了错误的均值描述.
嘿user1471980,我认为如果你有一个独特的用户名,人们更倾向于帮助但是你又有很多分数:)
| 归档时间: |
|
| 查看次数: |
9570 次 |
| 最近记录: |