ggdraw() + draw_plot(main, 0, 0, 0.9,1) + draw_plot(legend, 0.75, 0.05, 0.25, 0.25) 拼接ggplot2工具包绘制的图形需要借助cowplot工具包,因此需要对主图和图例分别进行命名; draw_plot函数同样使用的是相对尺度的坐标方式。 3.3 tmap 绘制方式如下: library(tmap) # 主图 tm_shape(Shp) + tm_fi...
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 读取渭河流域高程...
拼接ggplot2工具包绘制的图形需要借助cowplot工具包,因此需要对主图和图例分别进行命名; draw_plot函数同样使用的是相对尺度的坐标方式。 3.3 tmap 绘制方式如下: library(tmap) # 主图 tm_shape(Shp) + tm_fill(col = "col") + tm_shape(Border) + tm_borders(lwd = 2) + tm_compass(position = c(0....
draw_plot(plot.mpg, 0, 0, 0.5, 0.5) + # 在母图左下角,占母图比例1/4 draw_plot(plot.diamonds, 0.5, 0, 0.5, 0.5) + # 在母图右下角,占母图比例1/4 draw_plot_label(c("A", "B", "C"), c(0, 0, 0.5), c(1, 0.5, 0.5), size = 15, colour = "cyan", family = "Dan...
这在具体的出版物上通常是要求的。 语法结构与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,vjust=1.5,size=16,fontfa...
plot.margin = unit(c(0, 0, 0, 0), "inches")) #ggdraw() + draw_plot(ditu) print(ditu) 效果图: 四:绘制英国郡一级的地图 library(maps) library(mapdata) library(maptools) library(rgdal) library(ggmap) library(ggplot2) library(rgeos) ...
draw_plot_label(label, x = 0, y = 1, hjust = -0.5, vjust = 1.5, size = 16, fontface = "bold", family = NULL, colour = NULL, ...) 参数解释: plot 表示ggplot2绘图对象 x, y 表示子图的起点坐标(左下角坐标),在0-1之间,表示占母图的比例, ...
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,...
ggviolin(df4,"dose","len",add="none",draw_quantiles =0.5) # 添加箱线图 ggviolin(df4, x ="dose", y ="len",add="boxplot") # 添加点图 ggviolin(df4, x ="dose", y ="len",add="dotplot") # 添加 jitter points 扰动点,并且按照分组匹...
drawRect=TRUE) 实例 代码: 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") ...