使用的示範性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論壇上查看條款? –