[R] color.ramp in maptools

Marco Albani malbani at fas.harvard.edu
Fri Mar 26 19:54:51 CET 2004


Roger Bivand wrote:
> On Fri, 26 Mar 2004, Marco Albani wrote:
> At 
>>the moment I have some trouble understanding how the " auxvar " variable 
>>is supposed to be used in the plot.Map function.
>>
[...]
>>
>>I don't seem to be able to get any information on this color.ramp 
>>function. In fact the function doesn't seem to exist if I search for it 
>>with ls()
>>
>>Does anyone have any insight?
> 
> 
> The function is not exported in the package namespace (you can read it
> using the ::: operator: maptools:::color.ramp will display it). Its usage
> is: color.ramp(nclass,color='red',nvec=NULL,type='q'), where: nclass is
> the number of classes desired in the ramp; color is the base color to
> build the ramp on; nvec is the numeric vector (or factor) from which to 
> build the ramp; and type is the type of binning procedure to use (default 
> quantiles, if set to "e", it will use equal-sized bins.). 
> 

Thank you. So the way I understand it is that auxvar will actually be 
passed as nvec to color.ramp

I tried passing a numeric vector with the following summary stats:

  summary(NE.HWA.pols$att.data$RockDepth)
    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
     0.0   100.0   120.0   112.7   140.0   160.0

And on call

plot.Map(NE.HWA.pols, auxvar = NE.HWA.pols$att.data$RockDepth)

I got this error

Error in cut.default(nvec, brks, labels = FALSE, include.lowest = TRUE) :
	cut: breaks are not unique




More information about the R-help mailing list