The updateusr function in the TeachingDemos package can be used to change the
user coordinates of the first plot to match what you think they should before
adding to the plot.
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of tsippel
> Sent: Thursday, January 08, 2009 3:23 PM
> To: r-help at r-project.org
> Subject: [R] Alignment of image plot overlay
>
>
> I'm having trouble with alignment of a trend line overlayed onto an
> image
> plot. The two should be plotted on the same x-axis (time-series).
> However,
> the trend line begins about an inch into the image plot x-axis and ends
> about an inch off of end of the image plot. Once I have the alignment
> sorted, I need to put a secondary y-axis on the image plot which is
> scaled
> for the trend line. An example plot is attached. My code follows.
>
> tad.image(ptt.tad, dbins, interp=T, loess.interp=F, ylim=c(300,1),
> main="STM07.4", zlim=c(0,1))
> axis(4, at=c(1,2,3,4), labels=c(1,2,3,4), tick=T, las=1)
> par(new=T)
> plot(x=stm$dal, y=stm$model, ann=F, axes=F, type="l",
col="black",
> lwd=2)
>
> Ideas involving the use of par(usr=c(,,,)) haven't solved the issue,
> and
> attempting to convert the x-axis coordinates using the function
> grconvertX()
> hasn't worked either. Using the axis function as shown here hasn't
> helped
> either.
>
> The function above called tad.image() was written by someone else, but
> it
> calls the image() function to make the plot shown.
>
>
>
> http://www.nabble.com/file/p21362251/test.plot.jpeg test.plot.jpeg
> --
> View this message in context: http://www.nabble.com/Alignment-of-image-
> plot-overlay-tp21362251p21362251.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.