Skip to content
Prev 89 / 7420 Next

wmtsa

plot.wavCWT() accepts the argument "col" to plot, so you need to supply a 
vector of color specifications.

The following code shows an easy way to specify colors for a looong vector

#Example data
x <- rnorm(1000,0,1)

#Number of colors to use
n.colors = 10 

#We will use colors interpolated between these;
#will shade from chocolate to tan to green
color.scheme = c("chocolate", "tan", "green4")

#Save old color palette settings
oldPalette <- palette()

#Reset color palette to have 10 levels shaded as specified
#above
newPalette <- colorRampPalette(color.scheme, space = "Lab")
palette(newPalette(n.colors))

#Cut x into 10 bins; you could use different criteria
#for grouping x values; I used deciles
n.cuts <- n.colors + 1
cuts <- quantile(x, seq(from = 0, to = 1, length.out = n.cuts))
bins <- cut(x, cuts)

#Use bin indices to index color scheme
color <- as.numeric(bins)

#Plot the data
plot(x,pch=19,col=color)

#Reset to the original color scheme
palette(oldPalette)


*************************************************
Glen A. Sargeant, Ph.D.
Research Wildlife Biologist/Statistician
Northern Prairie Wildlife Research Center
8711 37th Street SE
Jamestown, ND  58401

Phone: (701) 253-5528
E-mail:  glen_sargeant at usgs.gov
FAX:     (701) 253-5553
*************************************************



"stephen sefick" <ssefick at gmail.com> 
Sent by: r-sig-ecology-bounces at r-project.org
05/19/2008 08:41 AM

To
r-sig-ecology at r-project.org
cc

Subject
[R-sig-eco] wmtsa






I would like to change the wavCWT (package wmtsa) plot colors does anyone
know how to do this.

d = wavCWT(x)# I can provide data but it is a rather large data set
plot(d) #default color scheme does not have enough contrast

thanks

Stephen