There are many ways to do this, here is one using an example from ?barplot

library(jpeg)
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
PNG).

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
raster graphics.

Cheers, Mike.

On Tue, Jul 10, 2012 at 5:19 PM, Manish Gupta <mandecent.gu...@gmail.com> wrote:
> Hi,
>
> I am wokring on stacked bar plot and i need to add one arrow dynamically.
>
>
> http://r.789695.n4.nabble.com/file/n4635959/arrow_glossy_right_red.jpg
>
> http://r.789695.n4.nabble.com/file/n4635959/Screenshot.10.png
>
> Final image:
>
> http://r.789695.n4.nabble.com/file/n4635959/Screenshot.1.png
>
> 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@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.



-- 
Michael Sumner
Hobart, Australia
e-mail: mdsum...@gmail.com

______________________________________________
R-help@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.

Reply via email to