使用的示范性image这里一个办法:
library(png)
ima <- readPNG("C:/Users/MyPC/Desktop/rus.png")
png <- "C:/Users/MyPC/Desktop/rus.png"
ima <- readPNG(png)
library(ggplot2)
tm <- theme(
panel.background = element_rect(fill = "transparent",colour = "black"), # or theme_blank()
panel.grid.minor = element_blank(),
panel.grid.major = element_blank(),
plot.background = element_rect(fill = "transparent",colour = NA)
)
plot.new()
lim <- par()
rasterImage(ima, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4])
library(grid)
vp <- viewport(.25, 0.65, width =.3, height = .3)
pl <- ggplot(mtcars, aes(x = mpg)) + geom_histogram() + tm
print(pl, vp = vp)
pl2 <- ggplot(mtcars, aes(x = mpg, y = wt)) + geom_line() + tm
vp2 <- viewport(.75, 0.65, width =.3, height = .3)
print(pl2, vp = vp2)
pl3 <- ggplot(mtcars, aes(x = mpg, y = wt)) + geom_line() + tm
vp3 <- viewport(.5, 0.4, width =.3, height = .3)
print(pl3, vp = vp3)
这样过于宽泛的问题被认为是题外话在SO,尤其如此,因为它要求包装区域经济共同体和教程。也许这些规则在其他堆栈交换场地中的规则不那么严格。为什么不在GIS论坛上查看条款? –