geom_hline和geom_vline分别用来添加水平线(horizontal)和垂直线(vertical) plot + geom_hline(yintercept =300) + geom_vline(xintercept =20) 如果只是要添加单条或者多条确定的直线,则只需要设置yintercept和xintercept参数即可。当然,可以通过colour,size,linetype来设置线条的外观等。 plot + geom_hline(y...
linetype=group))+geom_point(size=2)+geom_line(size=1)p1
element_line(colour=NULL,# 线条颜色linewidth=NULL,# 线条粗细linetype=NULL,# 线型 (0-8 或者 blank, solid, dashed, dotted, dotdash, longdash, twodash)lineend=NULL,# 线条端点样式 (round, butt, square)color=NULL,# 线条颜色arrow=NULL,# 箭头inherit.blank=FALSE# 是否继承父元素中存在的element_...
enviroPCA_plot <- ggplot(enviroPCA_sites, aes(x = PC1, y = PC2)) + geom_hline(yintercept = 0, linetype = "dotted") + geom_vline(xintercept = 0, linetype = "dotted") + geom_line(aes(group = city), alpha = 0.7) + geom_point(size = 2.75, shape = 21, colour = "black...
geom_line(aes(x, y), linetype = 2) + geom_abline(slope = seq(1.6, 2.4, 0.0001), color = "grey60", intercept = 0) + geom_abline(slope = 2, intercept = 0) + #coord_cartesian(ylim = c(0, 200), xlim = c(0, 100)) + ...
geom_hline(yintercept = 0, linetype = "dotted") + geom_vline(xintercept = 0, linetype = "dotted") + geom_segment(data = enviroPCA_vars, aes(x = 0, xend = PC1, y=0, yend = PC2, color = contrib), size = 2, arrow = arrow(length = unit(0.02, "npc")), alpha = 1)...
geom_line(color = "red", linetype = "dotted", size = .5) 1. 2. 设置一个内置主题,通过theme图层可以控制图片的主题,个人认为bw主题比较美观、简洁大方。 theme_set(theme_bw()) g + geom_point(color = "red") 1. 2. 调整坐标轴相关信息 ...
background = element_rect(color='red',linetype = 2)) 代码语言:javascript 复制 pt+scale_color_discrete(name='cyl')+ theme(legend.position = 'bottom', #将图例放置在图片底部 legend.text=element_text(color = 'red',size=13,angle=45), #设置图例中图标的标签,颜色为红色,字号为13,并呈45度...
线条类型标度【scale_linetype】 坐标系系统: 代码语言:javascript 复制 coord_flip()coord_polar()coord_map() 图例系统: 代码语言:javascript 复制 guides()guide_colorbar()guide_legend() 分面系统: 代码语言:javascript 复制 facet_grid()facet_wrap() ...
1、基础绘图 p1<-ggplot(data,aes(x,y,group=group,color=group,shape=group,linetype=group))+geom_point(size=2)+geom_line(size=1)p1 2、修改线形 p1+scale_linetype_manual(values=c(y1=4,y2=1,y3=3)) 3、自定义颜色 p1+scale_color_manual(values=c('#ec1c24','#fdbd...