R语言ggplot2绘图设置X轴刻度,字体大小及绘图区大小
导读:本文共1771.5字符,通常情况下阅读需要6分钟。同时您也可以点击右侧朗读,来听本文内容。按键盘←(左) →(右) 方向键可以翻页。
摘要:colnames(data1)[seq(2,ncol(data1),15)] [1] AAAA AAGG ATGC ACGT AGGA TACG TTCC  ..."> <div class="information-details"> <pre class="brush:cpp;toolbar... ...
目录
(为您整理了一些要点),点击可以直达。colnames(data1)[seq(2,ncol(data1),15)] [1] AAAA AAGG ATGC ACGT AGGA TACG TTCC  ...">
>ggplot(data2[data2$name==11,],aes(x=Tetra,y=Freq,group=1))+geom_line(size=0.2)+theme_bw()+scale_x_discrete(breaks=colnames(data1)[seq(2,ncol(data1),15)])
//scale_x_discrete可以设置x轴显示的刻度,调整稀疏程度,比如breaks=seq(0,12200,1000)
>ggplot(data2[data2$name==11,],aes(x=Tetra,y=Freq,group=1))+geom_line(size=0.2)+theme_bw()+scale_x_discrete(breaks=colnames(data1)[seq(2,ncol(data1),15)])+theme(axis.text.x=element_text(face="bold",color="blue",size=8))
//plot.margin用于theme()中,用于调整整个绘图区的边缘位置
>ggplot(data2[data2$name==11,],aes(x=Tetra,y=Freq,group=1))+geom_line(size=0.2)+theme_bw()+scale_x_discrete(breaks=colnames(data1)[seq(2,ncol(data1),15)])+theme(axis.text.x=element_text(face="bold",color="blue",size=8),plot.margin=unit(c(2,3,3,4),"cm"))
有三种方法可以设置x轴或y轴刻度范围
//scale_size可以把图中的数据点转化为不同大小的点
////
原始绘图代码:
R语言ggplot2绘图设置X轴刻度,字体大小及绘图区大小的详细内容,希望对您有所帮助,信息来源于网络。