我的資料是這樣的
df<- structure(list(team_3_F = c("browingal ", "newyorkish", "site",
"team ", "browingal ", "newyorkish", "site", "team ", "browingal ",
"newyorkish", "site", "team "), variable = structure(c(1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L), .Label = c("AAA_BBB_US",
"AAA_CCC_US", "AAA_BBB_CCC_US"), class = "factor"), value = c(0.166666666666667,
0.25, 0, 0.181818181818182, 0.0833333333333333, 1, 0, 0.0909090909090909,
0.0833333333333333, 0.25, 0, 0.0909090909090909)), row.names = c(NA,
-12L), class = "data.frame")
我正在像這樣繪制它
ggplot(mydf, aes(x = team_3_F, y = variable))
stat_summary_2d(
aes(z = value, fill = after_stat(value)),
geom = "tile"
)
我想知道是否有人如何將值添加到圖中(可讀?)
uj5u.com熱心網友回復:
與geom_text:
ggplot(df, aes(x = team_3_F, y = variable))
stat_summary_2d(
aes(z = value*100, fill = after_stat(value)),
geom = "tile")
geom_text(aes(label=round(value*100,2)))
guides(fill=guide_legend(title="Percent"))

轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/444200.html
上一篇:如何計算非線性回歸“y=2/(1 exp(a*x))-1”中的系數“a”?還要畫圖?
下一篇:ggplot線不通過形狀
