marchini@stats.ox.ac.uk
2001-Feb-27 09:00 UTC
[Rd] Plotting points on a filled.contour plot (PR#857)
Full_Name: Jonathan Marchini Version: R 1.2.2 OS: linux-gnu Submission from: (NULL) (163.1.103.108) When adding points to a filled.contour plot they do not appear at the correct coordinates. The following code demonstrates this. a<-expand.grid(1:20,1:20) b<-matrix(a[,1]+a[,2],20) filled.contour(x=1:20,y=1:20,z=b) points(10,10) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi> When adding points to a filled.contour plot they do not appear at thecorrect> coordinates. > The following code demonstrates this. > > a<-expand.grid(1:20,1:20) > b<-matrix(a[,1]+a[,2],20) > filled.contour(x=1:20,y=1:20,z=b) > points(10,10)The problem here is that filled.contour is actually a combination of two plots; one is the filled contour and one is the legend. filled.contour sets up two separate coordinate systems for these two plots, but only does so internally - once the function has returned these coordinate systems are lost. In order to access the coordinate system of the main contour plot you can specify graphics commands in the plot.axes argument. For example, in your case, replace your call to filled.contour with the following, and all is as it should be ... filled.contour(x=1:20,y=1:20,z=b,plot.axes={axis(1);axis(2);points(10,10)}) Paul -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._