library(cowplot) ggdraw(p1)+ draw_plot(p2,x=0.275,y=-0.36,scale = 0.38,width = 1,height = 1.7) 第三种图片叠加方法:ade4包,将基础绘图函数的绘图叠加到ggplot2绘图上 library(ade4) p1 add.scatter(barplot(1:10),posi="bottomright",ratio=0.35,bg.col = NULL, inset = c(-0.02,-0.02)) ...
plot.margin=unit(c(0,0,0,0),"cm")) -> china.ocean china.ocean 4.4 拼接中国大陆主体地图和南海小地图 ggdraw() + draw_plot(china.main) + draw_plot(china.ocean,x = .8, y = .03, width = .12, height = .20) -> total.china total.china 5. 绘制渭河流域底图 5.1 读取渭河流域高程...
语法结构与ggplot类似,将ggplot2图作为一个对象置于ggdraw()中 表达式: draw_plot(plot, x = 0, y = 0, width = 1, height = 1, scale = 1) draw_text(text, x = 0.5, y = 0.5, size = 14, hjust = 0.5, vjust = 0.5,...) draw_plot_label(label, x = 0, y = 1, hjust = -0.5...
可自定义图片在画布中的长宽比 library("cowplot")ggdraw()+draw_plot(p,x=0,y=.5,width=.5,height=.5)+draw_plot(q,x=.5,y=.5,width=.5,height=.5)+draw_plot(r,x=0,y=0,width=1,height=0.5)+draw_plot_label(label=c("A","B","C"),size=15,x=c(0,0.5,0),y=c(1,1,0.5)...
drawRect=TRUE) 1. 2. 3. 4. 实例 代码: eg5.2 library(vioplot) x1 <- mtcars$mpg[mtcars$cyl==4] x2 <- mtcars$mpg[mtcars$cyl==6] x3 <- mtcars$mpg[mtcars$cyl==8] vioplot(x1,x2,x3,names= c("4 cyl","6 cyl","8 cyl"),col = "gold") ...
ggdraw( xlim = c(0, 1.1), ylim = c(0, 0.30))+ draw_plot(aligned_plots[[1]], x=0,y=0, width=0.5, height = 0.28)+ draw_plot(aligned_plots[[2]], x=0.50,y=0, width = 0.5, height = 0.28) image.png 示例数据和代码可以在公众号后台留言20220608获取 ...
> library(plotrix) > plot(1:5,seq(1,10,length=5),type="n",xlab="",ylab="",main="Test draw.circle") > draw.circle(2,4,c(1,0.66,0.33),border="purple", + col=c("#ff00ff","#ff77ff","#ffccff"),lty=1,lwd=1) > draw.circle(2.5,8,0.6,border="red",lty=3,lwd=3) >...
data=read.table("ribbon_plot.txt",header=T,sep="\t")#draw the ribbonggplot(data,aes(Year,Anomaly10y))+geom_ribbon(aes(ymin=Anomaly10y-Unc10y,ymax=Anomaly10y+Unc10y),alpha=.2)+geom_line() 代码语言:javascript 复制 #change the visualization,using lines insteadofribbonggplot(data,aes(Year,...
首先,我们配置一下所需用到的R语言readxl包与ggplot2包;其中,readxl包是用来读取Excel表格文件数据的...
theme(axis.text.x =element_text(face="bold", size=8))+ theme(axis.text.y =element_text(face="bold", size=8)) p4 <-ggdraw(p3) +draw_plot(p2,0.3,0.25,0.5,0.7) ggarrange(p1,p4,ncol=1,nrow=2,labels=c("A","B"))