ggplot2坐標系列的調整

ggplot(kegg_class,aes(x = Description,y = Count)) + geom_bar(aes(fill = source),stat = "identity",width = 0.5,position = "dodge") + scale_fill_manual(values = c(up = "#ca0020",down = "#2b83ba")) + theme_classic()+
scale_y_continuous(expand = c(0,0))+ #去掉與Y軸間隙
labs(x = "" , y = "count",title = "")+ #修改x,y軸的標題
theme(axis.title.x = element_text(size = 14,face = "bold"),axis.title.y = element_text(size = 14,face = "bold"))+ # x軸標題,y軸標題字體的大小
theme(axis.text.x = element_text(size = 9,face = "bold"),axis.text.y = element_text(size = 9,face = "bold"))+ #修改x,y軸刻度線上的大小
theme(axis.ticks.y = element_blank())+ # 只刪掉y軸的刻度線,theme(axis.ticks = element_blank()) 刪掉所有的刻度線
theme(legend.position = "right") + # legend的位置,可旋轉right,left,top,bottom,none
theme(legend.position = c(0.7,0.3))+#legend.position也可以用兩個元素構成的數值向量來控制,主要是設置圖例在圖片中間所在具體位置
coord_flip()

?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內容