Re: [R] adding bmp/jpg/gif to an existing plot

2009-12-04 Thread baptiste auguie
Hi,

If you can first convert the image to ppm format, the pixmap package
has an addlogo function that can do just what you want,

x <- read.pnm(system.file("pictures/logo.ppm", package="pixmap")[1])
plot(1:10,1:10)
addlogo(x, px=c(2, 4), py=c(6, 8), asp=1)

One could probably get inspiration from the addlogo code to make a
similar function for EBImage.

Alternatively, you could use Grid graphics as shown in this page,

http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-grid:displaybitmap

I wrote a similar function for EBImage that you can use to annotate
ggplot2 graphics.

HTH,

baptiste



2009/12/3 Cézar Freitas :
> Hi, all.
> I searched a lot at mailing list, installed EBImage and gtk packages, but I
> couldn't make this simple work:
> How to add a image file (jpg or bmp ou gif) to an existing plot window (not
> plot over the image), like the code below (pseudo function add.image):
>
> plot(1:10,1:10,main="test")
> image = read.X("myimage.jpg")
>
> add.image(image, x.left=2, y.bottom=4, size="40%") #points the left-bottom
> corner and the reative size of image
>
> abline(x=3, col=2, lwd=2) #continues editing the plot window.
> text(2,3,labels="example of graphics and image")
>
> Is it possible?
>
> Thanks,
> Cezar Freitas
>
>        [[alternative HTML version deleted]]
>
> __
> 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.
>

__
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.


Re: [R] adding bmp/jpg/gif to an existing plot

2009-12-03 Thread Frank E Harrell Jr

Greg Snow wrote:

Look at the subplot function in the TeachingDemos package.


A copy of subplot is in the Hmisc package thanks to Greg.






--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
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.


Re: [R] adding bmp/jpg/gif to an existing plot

2009-12-03 Thread Greg Snow
Look at the subplot function in the TeachingDemos package.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Cézar Freitas
> Sent: Thursday, December 03, 2009 7:24 AM
> To: r-help@r-project.org
> Subject: [R] adding bmp/jpg/gif to an existing plot
> 
> Hi, all.
> 
> I searched a lot at mailing list, installed EBImage and gtk packages,
> but I couldn't make this simple work:
> 
> How
> to add a image file (jpg or bmp ou gif) to an existing plot window (not
> plot over the image), like the code below (pseudo function add.image):
> 
> 
> 
> 
> plot(1:10,1:10,main="test")
> 
> image = read.X("myimage.jpg")
> 
> 
> 
> add.image(image, x.left=2, y.bottom=4, size="40%") #points the left-
> bottom corner and the reative size of image
> 
> 
> 
> 
> abline(x=3, col=2, lwd=2) #continues editing the plot window.
> 
> text(2,3,labels="example of graphics and image")
> 
> 
> 
> Is it possible?
> 
> 
> 
> Thanks,
> 
> Cezar Freitas
> 
> 
> 
> ___
> _
> Veja quais são os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com
>   [[alternative HTML version deleted]]

__
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.


Re: [R] adding bmp/jpg/gif to an existing plot

2009-12-03 Thread Prof Brian Ripley

Look at the R-devel development version of R

o   The graphics engine now supports rendering of raster (bitmap)
images, though not all graphics devices can provide (full)
support.  Packages providing graphics devices (e.g., Cairo,
RSvgDevice, cairoDevice) will need to be reinstalled.

and

http://developer.r-project.org/Raster/raster-RFC.html

for more details (and older ways to do it less well).


On Thu, 3 Dec 2009, Cézar Freitas wrote:


Hi, all.

I searched a lot at mailing list, installed EBImage and gtk packages, but I 
couldn't make this simple work:

How
to add a image file (jpg or bmp ou gif) to an existing plot window (not
plot over the image), like the code below (pseudo function add.image):




plot(1:10,1:10,main="test")

image = read.X("myimage.jpg")



add.image(image, x.left=2, y.bottom=4, size="40%") #points the left-bottom 
corner and the reative size of image




abline(x=3, col=2, lwd=2) #continues editing the plot window.

text(2,3,labels="example of graphics and image")



Is it possible?



Thanks,

Cezar Freitas


 

Veja quais s?? os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
[[alternative HTML version deleted]]




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
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.