问题描述
我正在尝试使用geom_tile绘制热图。
此Google驱动器链接中的数据示例:
https://drive.google.com/file/d/1wO0AEyyrVbhlw-riydWHkeTNARYa4xJW/view?usp=sharing
代码如下:
Date Name Salary AC GM KL MC
0 01/01/2019 Jack 50,000 1 1 0 1
1 01/01/2019 Sam 30,000 1 0 1 0
2 01/01/2019 Los 45,000 0 1 0 0
这里是数字输出
问题是我希望每个带的宽度和高度都更大,以便所有内容都清晰易读。
我试图在geom_tile中设置高度和宽度
#define color
library(wesanderson)
pal <- wes_palette("Zissou1",50,type = "continuous")
b<- ggplot(C1.TN)
d<- b +
geom_tile(aes(x=Combination,y=Drug_dose,fill=Avg.percent))+
geom_text(aes(x=Combination,label=Avg.percent),size=3)+
scale_fill_gradientn(colors=pal)+
theme(legend.text = element_text(size=10,face="bold",color = "black"))+
theme(axis.text.x = element_text(size = 15,color = "black")) +
theme(axis.text.y = element_text(size = 9,color = "black")) +
theme(axis.title.x = element_text(size = 15,color = "black",vjust = 3))+
theme(axis.title.y = element_text(size = 15,hjust = 0.5))+
theme(plot.title = element_text(size = 16))+
theme(strip.text.y = element_text(size = 10,face = "bold",color = "black"))+
scale_x_discrete(position ="top") +
xlab("Combination added")+
ylab("Treatments in the screen")+
ggtitle("Cluster 1 Enriched in TN response")
print(d)
,但是问题是我的y轴治疗标签会偏离对齐状态。如果更改宽度,同样的问题,则我的x轴列名称完全不对齐。
那么,在保持轴标签的适用性的同时,如何更改每个图块的大小以使其更大呢?最好我还要调整y轴标签的间距。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)