我需要在图像上绘图。我遇到的问题是我的PNG图像没有调整到网格:
ext.sharedGroup = {dependencyHandler->
delegate = dependencyHandler
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
}
答案 0 :(得分:1)
你可以做到
library(webshot)
library(png)
library(ggplot2)
library(grid)
webshot("http://www.doctormetrics.com/",tf<-tempfile(fileext = ".png"))
img <- readPNG(tf)
g <- rasterGrob(img, interpolate=TRUE, height = 1, width = 1)
ggplot() +
annotation_custom(g, xmin=1, xmax=2, ymin=1, ymax=2) +
geom_point(aes(x,y), data.frame(x=1:2, y=1:2)) +
coord_fixed(ratio = nrow(img)/ncol(img))