ggplot(Data, aes(x = Cancer, y =Type, fill = Number)) +
geom_tile() +
scale_x_discrete(position="top") + #设置x轴坐标位置
scale_fill_gradient(low = "white", high = "#0000ff") + #设置热图颜色的过渡值
theme_minimal() +
facet_grid(Type ~ ., scales = "free_y", space = "free") + #设置面板
theme(strip.placement = "outside", strip.background = element_blank(),
axis.title.y = element_blank(), #删掉y轴的题目
axis.text.x = element_text(angle = 45, vjust = 1), #设置x轴的坐标倾斜度
panel.spacing.y = unit(0.5, "mm")) #设置每个面板的距离 panel.spacing.y = unit(0.5, "mm")、panel.spacing.x = unit(1, "cm")
参考:
ggplot2的一系列分面设置(全网最全) - 知乎 (zhihu.com)
标签:面板,spacing,ggplot,设置,热图,unit,panel From: https://www.cnblogs.com/huaguang13/p/17834502.html