ggplot語(yǔ)法
ggplot(mydata,aes(x=sample,y=num,fill=type))+
geom_bar(stat = 'identity',position = 'stack',color = 'white',width = 0.6)+
geom_text(aes(label=num),position = position_stack(vjust = 0.5),color='white',size=4)+
xlab('Hours after ETH treatment') +
ylab('Number of significantly DEGs')+
####### 添加參考線
#geom_hline(yintercept = totals,colour = 'gray',linetype='dashed',size = 0.5) +
########### 填充顏色
scale_fill_brewer(palette = "Set1")+
#scale_fill_manual(values=alpha(c("#FFA500","#6495ED"), 1))+
############# 刪除背景和刻度線
theme_bw() +
theme(panel.grid = element_blank())+ ###刪除網(wǎng)格線
#theme(axis.text = element_blank()) + ## 刪去刻度標(biāo)簽
theme(axis.ticks.x = element_blank()) + ## 刪去刻度線
theme(panel.border = element_blank()) + ## 刪去外層邊框
theme(axis.title = element_text(size = 10))+
theme(axis.text = element_text(size = 10,color = 'black'))+
############# 加邊框和自定義y軸刻度
theme(axis.line = element_line(size = 0.5,color = 'black'))+
scale_y_continuous(breaks=c(0,730,837,1046,1453),
labels=c(0,730,837,1046,1453),
limits = c(0,1500),
expand = c(0,6)) +
############### 圖例
theme(legend.position = c(0.2,0.95))+
guides(fill=guide_legend(title = NULL)) +
theme(legend.key.size = unit(12, "pt"),
legend.key.height = unit(12, "pt"),
legend.key.width = unit(12, "pt"),
legend.text = element_text(size = 10))
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。