【发布时间】:2021-02-06 22:18:03
【问题描述】:
我需要一张热图:
- 红色的“否”
- “是”为绿色。
- x 轴上的城市
- y 轴运动
library(ggplot2)
df = data.frame(City= c(Boston, Caracas, Madrid, Tokio),
Val = c(Yes, No, No, Yes),
Sport = c("Soccer","Soccer","Soccer","Soccer"))
【问题讨论】:
-
试试
ggplot(df, aes(x = City, y = Sport, fill = Val)) + geom_tile()
标签: r ggplot2 plotly heatmap data-manipulation