Looking at ?contourplot, it would appear it should be ok to set region=TRUE.

So this is a case of "time to explore".

Have you tried levelplot instead of contourplot? The default for levelplot is region=TRUE, vs region=FALSE for contourplot. If levelplot also fails, that tells you something different than if levelplot succeeds. Exactly what it tells you I'm not sure, but it's information!

Are you familiar with the traceback() function? If not, call it immediately after contourplot() fails. The output of traceback() often leads to an understanding of what went wrong.

Try contourplot() with fewer levels (a smaller value for cuts, and see if it succeeds with some smaller value.

-Don

At 10:12 AM -0400 4/16/09, Cable, Samuel B Civ USAF AFMC AFRL/RVBXI wrote:
Call off the dogs.  The problem was that because of the scale of my data
(<<1) contourplot somehow can't handle labeling the contours if it
"paints" the plot region as well.  I can easily get around this by
re-scaling the data.  But, if anyone can explain to me why throwing the
region=T flag makes a difference, I would be interested to know.  Thanks
again!

--Sam



-----Original Message-----
From: Cable, Samuel B Civ USAF AFMC AFRL/RVBXI
Sent: Thursday, April 16, 2009 9:55 AM
To: 'r-help@r-project.org'
Subject: weird error with contourplot

Sorry if I am cluttering up this list with too many rank beginner
questions.  But I *am* a rank beginner, and I am at my wit's end with
this one:

I have a data frame df, with components x,y,z.  This command to make a
contour plot with lattice graphics works just fine:

 contourplot(z~x*y,data=df,cuts=20)

Then I try

 contourplot(z~x*y,data=df,cuts=20,region=T)

And it dies on me with the error:

Error in unit(x, default.units) : 'x' and 'units' must have length > 0


I have done maybe a hundred contour plots in this same exact way, and
have never seen this error before.  And it seems to me that adding the
flag region=T should be a benign thing to do.  I have no idea what it
causing the problem.  Anyone see what I'm doing wrong?  Thanks!

--Sam Cable

______________________________________________
R-help@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.


--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062

______________________________________________
R-help@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.

Reply via email to