How do I overlay an image on to a ggplot?

后端 未结 3 1083
礼貌的吻别
礼貌的吻别 2020-12-15 22:11

I\'d like to read an image from the web. e.g.

http://api.altmetric.com/donut/502878_64x64.png

and insert it into the top right of a ggplot

3条回答
  •  鱼传尺愫
    2020-12-15 22:25

    The correct solution was this:

    # This was one of my issues, reading a png from the web
    my_image <-  readPNG(getURLContent('http://path.to/image.png'))
    p1 + annotation_raster(my_image, ymin = 4,ymax= 5,xmin = 30,xmax = 40)
    

提交回复
热议问题