[R] How to use external image with R plot?
mdsumner at gmail.com
Tue Jul 10 13:03:55 CEST 2012
There are many ways to do this, here is one using an example from ?barplot
x <- readJPEG("arrow_glossy_right_red.jpg")
barplot(VADeaths, border = "dark blue")
rasterImage(x, 0, 60, 1, 80)
You'll have to change those numbers to suit your plot, par('usr")
gives a quick idea of the extents. You should be able to see that JPEG
is not a good format for drawings like this (and using images like
this is not a good method anyway since you never know what scale you
might want the shape to be drawn at). You might be better just using
?arrows or ?symbols but if you are bound to a particular image source
try to save it as a pixel format that doesn't crush the data (such as
Also, I'm not really "merging images" here, and I wouldn't say that's
the way to go about it. This is using R's plot support for vector and
On Tue, Jul 10, 2012 at 5:19 PM, Manish Gupta <mandecent.gupta at gmail.com> wrote:
> I am wokring on stacked bar plot and i need to add one arrow dynamically.
> Final image:
> Is there any packae which can be used for merging images?
> View this message in context: http://r.789695.n4.nabble.com/How-to-use-external-image-with-R-plot-tp4635959.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
e-mail: mdsumner at gmail.com
More information about the R-help