Hi: I am doing some work that involves plotting points of interest superimposed on photographs and maps. I can produce the plots fine in R, but so far I have had to do the superimposition externally, which makes it tedious to do exploratory work. I have looked to see if there is some capability to put a background picture on a plot window, but I have not found anything. Advice, anyone? Cheers Robert Biddle
Check out these posts: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/94605.html http://finzi.psych.upenn.edu/R/Rhelp02a/archive/66704.html On 4/11/07, Robert Biddle <robert_biddle at carleton.ca> wrote:> Hi: > > I am doing some work that involves plotting points of interest > superimposed on photographs and maps. I can produce the plots fine in R, but so far > I have had to do the superimposition externally, which makes it tedious to do exploratory work. > I have looked to see if there is some capability to put a background picture on a plot window, > but I have not found anything. > Advice, anyone? > > Cheers > Robert Biddle > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >
On Wed, 11 Apr 2007, Robert Biddle wrote:> Hi: > > I am doing some work that involves plotting points of interest > superimposed on photographs and maps. I can produce the plots fine in R, but so far > I have had to do the superimposition externally, which makes it tedious to do exploratory work. > I have looked to see if there is some capability to put a background picture on a plot window, > but I have not found anything. > Advice, anyone?The cover from Paul Murrell's book "R Graphics" does just that. http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html for examples. Dave -- Dr. David Forrest drf at vims.edu (804)684-7900w drf5n at maplepark.com (804)642-0662h http://maplepark.com/~drf5n/
This example isn't quite what you're asking for, but perhaps it's a starting point: http://addictedtor.free.fr/misc/gabor/ Earl F. Glynn Stowers Institute "Robert Biddle" <robert_biddle at carleton.ca> wrote in message news:461CE523.2090906 at carleton.ca...> I am doing some work that involves plotting points of interest > superimposed on photographs and maps. I can produce the plots fine in R, > but so far > I have had to do the superimposition externally, which makes it tedious to > do exploratory work. > I have looked to see if there is some capability to put a background > picture on a plot window, > but I have not found anything. > Advice, anyone?
Take a look at Figure 3.26 from Paul Murrell's book and associated code posted here: http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter3.html -Christos> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Robert Biddle > Sent: Wednesday, April 11, 2007 9:40 AM > To: r-help at stat.math.ethz.ch > Subject: [R] graphs superimposed on pictures? > > Hi: > > I am doing some work that involves plotting points of > interest superimposed on photographs and maps. I can produce > the plots fine in R, but so far I have had to do the > superimposition externally, which makes it tedious to do > exploratory work. > I have looked to see if there is some capability to put a > background picture on a plot window, but I have not found anything. > Advice, anyone? > > Cheers > Robert Biddle > > ______________________________________________ > R-help at stat.math.ethz.ch 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. > >
Here are some examples that may be what you are looking for: library(rimage) x <- read.jpeg(system.file("data", "cat.jpg", package="rimage")) plot(x) par(new=TRUE) plot( runif(100), rnorm(100), col='green' ) x2 <- x/4 + 3/4 plot(x2) locator() # click on corners to get extent of picture library(TeachingDemos) subplot( fun=plot(runif(100), rnorm(100)), x=c(-1.26, 416.65), y=c(0.1744, 421.57) ) library(maptools) plot(state.vbm, xlim=c(0,55), ylim=c(20,60)) tmp <- structure(list(x = c(16, 20, 32, 46, 32, 45), y = c(39, 54, 52, 51, 34, 34)), .Names = c("x", "y")) # from locator() states <- c('California','Nevada','Utah','Colorado','Arizona','New Mexico') data(Teacher, package='BSDA') for (s in states){ i <- which(Teacher$State == s) j <- which(states==s) subplot( plot( c(73, 83, 93), Teacher[i,-1], type='b',xlab='',ylab='' ), tmp$x[j], tmp$y[j], size=c(.5,.5)) } Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at intermountainmail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Robert Biddle > Sent: Wednesday, April 11, 2007 7:40 AM > To: r-help at stat.math.ethz.ch > Subject: [R] graphs superimposed on pictures? > > Hi: > > I am doing some work that involves plotting points of > interest superimposed on photographs and maps. I can produce > the plots fine in R, but so far I have had to do the > superimposition externally, which makes it tedious to do > exploratory work. > I have looked to see if there is some capability to put a > background picture on a plot window, but I have not found anything. > Advice, anyone? > > Cheers > Robert Biddle > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >
Robert Biddle <robert_biddle <at> carleton.ca> writes:> > Hi: > > I am doing some work that involves plotting points of interest > superimposed on photographs and maps. I can produce the plots fine in R, butso far> I have had to do the superimposition externally, which makes it tedious to doexploratory work.> I have looked to see if there is some capability to put a background pictureon a plot window,> but I have not found anything. > Advice, anyone? > > Cheers > Robert Biddle > > ______________________________________________ > R-help <at> stat.math.ethz.ch 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. > >In Windows, an easy solution is to use a transparency program (such as freeware available at http://www.martinutils.com/) and place R's plot directly over the target image. --David McArthur UCLA School of Medicine, Los Angeles, CA
I think the previous suggestions have solved your problem, but just in case you need even more flexibility, you could try using the cairo graphics device (cairoDevice) in conjunction with the GdkPixbuf bindings provided by RGtk2. This allows fairly advanced image manipulation operations (scaling, compositing, ...) on R graphics. Michael On 4/11/07, Robert Biddle <robert_biddle@carleton.ca> wrote:> > Hi: > > I am doing some work that involves plotting points of interest > superimposed on photographs and maps. I can produce the plots fine in R, > but so far > I have had to do the superimposition externally, which makes it tedious to > do exploratory work. > I have looked to see if there is some capability to put a background > picture on a plot window, > but I have not found anything. > Advice, anyone? > > Cheers > Robert Biddle > > ______________________________________________ > R-help@stat.math.ethz.ch 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. >[[alternative HTML version deleted]]
At 14:39 11/04/2007, Robert Biddle wrote:>Hi: > >I am doing some work that involves plotting points of interest >superimposed on photographs and maps. I can produce the plots fine >in R, but so far >I have had to do the superimposition externally, which makes it >tedious to do exploratory work. >I have looked to see if there is some capability to put a background >picture on a plot window, >but I have not found anything. >Advice, anyone?Although my situation was not exactly the same as yours you may find http://finzi.psych.upenn.edu/R/Rhelp02a/archive/42884.html a help>Cheers >Robert Biddle > >Michael Dewey http://www.aghmed.fsnet.co.uk