[R] filled.contour and points

Roger Peng rpeng at stat.ucla.edu
Tue Nov 26 18:59:17 CET 2002


In the help page for filled.contour() it says that you have insert code
which adds to the plot via the 'plot.axes'.  For example,

> a  <- matrix(0, 10, 10)
> x <- runif(10)
> y <- runif(10)
> filled.contour(a, plot.axes = points(x, y))

However, if you do this, you'll notice the axes are gone.  You need to
include explicit calls to axis() to solve this problem:

> filled.contour(a, plot.axes = { points(x, y); axis(1); axis(2) })

You can put a lot of code in the 'plot.axes' argument (using text(),
points(), lines(), etc.) and make really nice plots.

-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng

On Tue, 26 Nov 2002, Chong Gu wrote:

> 
> I was trying to add points to filled.contour plots, but the
> points(...) function apparently uses a different coordinate system
> than the filled.contour(...) function; it appears that points(...)
> paints points where they would be if the contours were stretched over
> the whole plotting frame including the legend bar.  Am I missing
> something or is it a "misalignment" in the code?
> 
> BTW, I have no problem adding points to regular contour plots.
> 
> Chong Gu
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help 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-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list