[R] asking about contour plot with R

Duncan Murdoch murdoch.duncan at gmail.com
Fri Apr 8 18:22:49 CEST 2011

On 08/04/2011 9:16 AM, nferreri at fceia.unr.edu.ar wrote:
> I'm working in Rosario, Argentina, trying to plot some contours.
> I found the function "draw.contour" created by James Forester at
> R-bloggers. If you take a look at that function you'll see it's very
> useful!
> But I have a problem with it and James is trying to help me (but also
> asked me to seek for more help) I hope you can help me (don't worry if you
> can't):
> Using "draw.contour" I get the contour but I want to place it in a
> cartesian-coordinate system where x = "Componente 1" range between -1 y 1
> and y = "Componente 2" range between 0 and 3, regardless of xrange or
> yrange.
> Of course, xrange and yrange are important to obtain an adequate contour
> plot but I want to see that contour in the cartesian coordinate system I
> told you before.
> so I put ylim = c(0,3) and xlim = c(-1,1) but R ignores those sentences
> and gives me a graphic using xrange and yrange as limits
> can anyone help me? I hope you can understand my problem (and my poor
> english!!!). if you don't, tell me and i'll send you more information
> thank you very much!!!

My advice would be to use the contour() function, rather than 
"draw.contour".  I would guess the latter was written to solve a 
particular problem, whereas contour() is the general purpose function in 
base R, and it does respect your requests for xlim and ylim.

Duncan Murdoch

More information about the R-help mailing list