wash: Wash Color Palette In phalen: Phalen Algorithms and Functions

Description

Color Palette for R.

Usage

 `1` ```wash(color, grade) ```

Arguments

 `color` Name of the color or color vector to be returned. Run `wash.showall()` or see details for a complete list of accepted `color` arguments. `grade` A positive numeric value. For `grade` between `0` and `1`, a single color of gradient `grade` will be returned. For `grade` between `1` and `61`, a character vector of N equidistant grandients will be returned.

Details

Use `wash.showall()` to see the list of colors available and to return 15 of the 61 color gradients. Below is a list of all colors:

`"grd1"` green to red, vibrant

`"grd2"` green to red, pale

`"blu1"` blue

`"blu2"` dark blue

`"grn1"` lime green

`"grn2"` green

`"ylw"` yellow

`"org"` orange

`"red1"` orange to red

`"red2"` pink to red

`"prp1"` purple

`"prp2"` dark purple

`"cyn"` cyan

`"grb"` grey blue

`"gry"` grey

Value

A color or vector of colors.

`washout`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77``` ``` # show all colors wash.showall() # --------------------------------------------- # Chose a single color: # --------------------------------------------- # Specify the color then specify a gradient 0-1. # Here is purple2 at 30% washcol = wash('prp2',0.3) plot(1,1,col = washcol,cex = 21,pch=16,axes = FALSE,xlab = "",ylab = "") # purple2 at 100% washcol = wash('prp2',1) plot(1,1,col = washcol,cex = 21,pch=16,axes = FALSE,xlab = "",ylab = "") # --------------------------------------------- # Chose a vector of colors: # --------------------------------------------- # Specify the color then specify the number of # gradients (1-61) to include in the vector. Here # are 5 shades of blue1. washcol = wash("blu1",5) plot(seq.int(1,5),rep(1,5),col = washcol,pch=15,cex = 10 ,axes = FALSE,xlim = c(0.5,5.5),xlab = "",ylab = "") # chose 5 different colors washcol = c(wash("blu1",1), wash("grn2",1), wash("ylw",1), wash("org",1), wash("red2",1)) plot(seq.int(1,5),rep(1,5),col = washcol,pch=15,cex = 10 ,axes = FALSE,xlim = c(0.5,5.5),xlab = "",ylab = "") # 61 shades of greenred1 (for heat maps) washcol = wash("grd1",61) plot(seq.int(1,61),rep(1,61),col = washcol,pch=15,cex = 21 ,xlim= c(-4,54),axes = FALSE,xlab = "",ylab = "") # --------------------------------------------- # Expand a color vector to match data # --------------------------------------------- # plot readmission by age, no color data(ipadmits) attach(ipadmits) ipadmits.summary = data.frame("AvgReadmission" = tapply(ipadmits\$isReadmission ,ipadmits\$Age ,mean) ,"AvgCost" = tapply(ipadmits\$cost ,ipadmits\$Age ,mean)) plot(ipadmits.summary\$AvgReadmission ,xlab = "Age",ylab = "AvgReadmission") # get vector of 9 greenred1 colors then expand color vector # to match readmission data with color gradient increasing by # value of avg readmission washcol = wash("grd1",9) washoutcol = washout(ipadmits.summary\$AvgReadmission,washcol,method = "value") plot(ipadmits.summary\$AvgReadmission,col=washoutcol ,pch=16,xlab = "Age",ylab = "AvgReadmission") # increase gradient by the index of the vector Age of value washoutcol = washout(ipadmits.summary[,1],washcol,method = "index") plot(ipadmits.summary\$AvgReadmission,col=washoutcol ,pch=16,xlab = "Age",ylab = "AvgReadmission") # increase gradient by average cost washoutcol = washout(ipadmits.summary\$AvgCost[1:60] ,washcol, method = "value") plot(ipadmits.summary\$AvgReadmission[1:60], col=washoutcol , pch=16,xlab = "Age", ylab = "AvgReadmission") detach(ipadmits) ```