I am trying to display a single observation in a population of 400 using boxplot ggplot2.
(我正在尝试使用boxplot ggplot2在400个人口中显示一个观察值。)
I was able to display this using text, but I would like to do that using a point with a colour different from the rest. (我可以使用文本来显示它,但是我想使用与其他颜色不同的点来显示。)
This is the code that I managed to code so far. (到目前为止,这是我设法编写的代码。)
[![I also added a picture of how the results look][1]][1] ([![我还添加了一张有关结果外观的图片] [1]] [1])
HEXACO<-data10[, c("Record","Emotionality","Extraversion", "Agreeableness",
"Conscientiousness","Openness", "Honesty_Humility")]
data_long <- gather(HEXACO, hexaco, score, Openness, Conscientiousness, Agreeableness, Extraversion,
Emotionality, Honesty_Humility, factor_key=TRUE)
Oliver <-data_long[c(1, 11, 21, 31, 41, 51), c("hexaco", "score")]
HEXACO <- ggplot(data = data_long, aes(x= hexaco, y= score)) +
geom_boxplot(width = 0.6, fill = "lightgrey", alpha = 0.5) +
coord_flip() +
theme_USGS_box()+
scale_y_continuous(breaks=c(0,0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5))+
expand_limits(y = 1:5)+
geom_text(data = Oliver, label = "Oliver",size = 3)+
labs(title = "HEXACO Profile", x = "Honesty-Humilty", y = "Score")
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/9QYmp.png
ask by Zeina Al Khaznachi translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…