theme(axis.ticks = element_blank(), axis.text.y = element_blank()) 注意:x轴的刻度线也被同时隐去。 图4 五、y轴的坐标轴文本、刻度线、图内表征y轴位置的白线也隐去(图5): pg_plot + scale_y_continuous(breaks = NULL) 图5
003、设置刻度标签的粗细 library(ggplot2) ggplot(data=mtcars, aes(x=mpg, y=disp, color=factor(cyl))) +geom_point()+theme(axis.ticks.length.x= unit(0.5,'cm'), axis.ticks.length.y= unit(0.5,'cm'), axis.ticks.x= element_line(colour ="black",size =5),## 设置刻度标签的粗细axis....
5、调整y轴刻度粗细 p+theme(axis.ticks.y=element_line(color="black",size=3,lineend =10))
(size = 10, # y轴刻度文字 angle = 0, vjust = 0.5), # axis.ticks = element_blank(), # 刻度参数 legend.position = "right", # 图例位置 legend.text = element_text(size = 10), # 图例文字 legend.title = element_text(size = 10), # 图例标题 legend.key.size = unit(10, "pt")...
ymax= Avg_len+sd/3, color=sex), width=0.1,show.legend=F) p3 #自定义图形主题; mytheme<- theme(panel.background = element_rect(fill = NA), plot.margin = margin(t=10,r=10,b=5,l=5,unit ="mm"), # axis.ticks.y = element_blank, ...
p <- ggplot(data=diamond, mapping=aes(x=carat, y=price, shape=cut)) p+geom_point() #绘制点图 1. 2. #将钻石的切工(cut)映射到分组属性: #默认分组设置, 即group=1 p + geom_boxplot() #分组(group)也是ggplot2种映射关系的一种, 如果需要把观测点按额外的离散变量进行分组处理, 必须修改默...
axis.ticks坐标轴刻度线 axis.ticks.x axis.ticks.y 在设置上述属性时,需要使用element_line()函数,element_line()的定义为: element_line(colour=NULL,size=NULL,linetype=NULL,lineend=NULL,color=NULL,arrow=NULL,inherit.blank=FALSE) 其中, colour/color表示线条的颜色 ...
axis.ticks.y.left=element_line(color="red"),axis.ticks.y.right=element_line(color="blue"),axis.text.y.left=element_text(color="red",size=text_size),axis.text.y.right=element_text(color="blue",size=text_size),axis.title.y.left=element_text(color="red",size=text_size+2),axis....
2-5、axis.ticks.length.x/.y,定义刻度线的长度,因为横轴的刻度线不一定有,所以分开定义,负数就是刻度线内置,正数就是外置。 3、图例主题: 1-1、legend.background,图例一般是不需要背景颜色的。 1-2、lengend.position,图例位置,这个很重要,除了上下左右英文参数,还可以用左下角坐标(0,0),右上角坐标(1,...
# theme(axis.ticks.y = element_blank()) ## 设置 axis.ticks.y 则只删去 Y 轴的刻度线,X 轴同理。 p 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 如何去掉外层边框: library(ggplot2) dt = data.frame(A = 1:10, B = c(2,15,6,18,9,7,13,15,10,3), C = ...