[R] How to use external image with R plot?

Greg Snow 538280 at gmail.com
Thu Jul 12 19:10:45 CEST 2012


You can use the locator function to retrieve the user coordinates of a
point that you click on in the plot, then use those points with
rasterImage to add the image.  So replace the last 2 lines of
Michael's answer with something like:

> barplot(VADeaths, border = "dark blue")
> tmp <- locator(1)
> rasterImage(x, tmp$x - 1, tmp$y - 10, tmp$x, tmp$y + 10)




On Tue, Jul 10, 2012 at 8:05 PM, Manish Gupta <mandecent.gupta at gmail.com> wrote:
> Hi,
>
> I need to position arrow according to content of data dynamically. let's say
> i have vector c(2,3,56,9) and i need to put arrow at 56 dynamically.  How
> can i use above method.
>
> Regards
>
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-use-external-image-with-R-plot-tp4635959p4636088.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com



More information about the R-help mailing list