我的 df 看起來像這樣:
Training_Task <- c("Imag", "Imag", "Imag", "Imag", "Rephrasing", "Rephrasing", "Rephrasing", "Rephrasing")
emotionality <- c("emo", "neu", "emo", "neu", "emo", "neu", "emo", "neu")
target_type <- c("novel", "novel", "pseudo", "pseudo", "novel", "novel", "pseudo", "pseudo")
acc <- c(93, 95, 97, 98, 96, 94, 92, 90)
df <- data.frame(Training_Task, emotionality, target_type, acc)
現在我想創建一個看起來像這樣的條形圖:
plot = ggplot(df, aes(fill =Training_Task, y=acc, x=target_type))
但我希望通過飽和的情感條(情感 = emo)和蒼白的中性條(情感 = neu)來添加 IV 情感。
有沒有辦法做到這一點?
uj5u.com熱心網友回復:
您可以alpha在您的審美中使用并將位置設定為dodge:
ggplot(df)
geom_bar(aes(fill = Training_Task, y=acc, x=target_type, alpha = emotionality), stat = 'identity', position = "dodge")
theme_minimal()
scale_alpha_discrete(range = c(1,0.4))

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/420802.html
標籤:
