Selection of colors for Likert plots.
Selection of colors for Likert plots.
ColorSet(nc, ReferenceZero=NULL) likertColor(nc, ReferenceZero=NULL, colorFunction=c("diverge_hcl","sequential_hcl"), colorFunctionOption=c("lighter","flatter","default"), colorFunctionArgs= likertColorFunctionArgs[[colorFunctionOption, colorFunction]], ...) likertColorBrewer(nc, ReferenceZero=NULL, BrewerPaletteName="RdBu", middle.color="gray90") brewer.pal.likert(n, name, middle.color)
n, nc |
Number of colors in the palette.
If there are more levels than |
ReferenceZero |
Numeric scalar or |
colorFunction |
Function name from the colorspace package,
either |
colorFunctionOption |
Name of a list item defined inside the
|
colorFunctionArgs |
list of arguments to the colorspace
function.
The default selects the values by indexing into a list defined in the
|
. For non-default usage, see the BlueOrange example in this help page.
... |
Other arguments are ignored. |
BrewerPaletteName, name |
|
middle.color |
Darker middle color than the default
|
These are support functions for the plot.likert
function.
Please see plot.likert
for details.
likertColor
uses by default the diverge_hcl
diverging palette defined by the argumentcolorFunctionOption="lighter"
.
likertColorBrewer
by default uses the "RdBu"
diverging palette from RColorBrewer
.
ColorSet
returns a vector of integers, one per each level,
corresponding to the strength of the levels from Disagree to Agree.
For balanced levels, such asc("Disagree Strongly", "Disagree Weakly", "Agree
Weakly", "Agree Strongly")
,
corresponding to nc=4,
ReferenceZero=2.5
, it returns -2 -1 1 2
.
For unbalanced levels, such as c("Disagree", "Neutral", "Agree
Weakly", "Agree Strongly")
, corresponding to nc=4,
ReferenceZero=2
, it returns -1 0 1 2
.
likertColor
returns a subset of a palette constructed by
either diverge_hcl
or
sequential_hcl
in the
colorspace package.
The subset corresponds to the levels specified by ColorSet
.
brewer.pal.likert
returns a
RColorBrewer
palette.
likertColorBrewer
returns a subset of a palette constructed by
brewer.pal.likert
.
The subset corresponds to the levels specified by ColorSet
.
Richard M. Heiberger, with contributions from Naomi B. Robbins <naomi@nbr-graphs.com>.
Maintainer: Richard M. Heiberger <rmh@temple.edu>
brewer.pal.likert(4, "RdBu") brewer.pal.likert(5, "RdBu") ColorSet(4) ColorSet(4, 2) likertColor(4) likertColor(4, 2.5) ## same as above likertColor(4, 2) ## one negative level and two positive levels: default likertColor(5, 3)[-2] ## one negative level and two positive levels: stronger negative ## Not run: ## Examples illustrating the six predefined likertColor palettes, and how ## to define additional hcl color palettes for use with the likert functions. data(ProfDiv) ProfDiv.df <- data.frame(ProfDiv) likert( ~ . , ProfDiv.df, horizontal=FALSE, positive.order=FALSE) likert( ~ . , ProfDiv.df, horizontal=FALSE, positive.order=FALSE, colorFunctionOption="default") likert( ~ . , ProfDiv.df, horizontal=FALSE, positive.order=FALSE, colorFunctionOption="flatter") likert( ~ . , ProfDiv.df, horizontal=FALSE, positive.order=FALSE, colorFunction="sequential_hcl") likert( ~ . , ProfDiv.df, horizontal=FALSE, positive.order=FALSE, colorFunction="sequential_hcl", colorFunctionOption="default") likert( ~ . , ProfDiv.df, horizontal=FALSE, positive.order=FALSE, colorFunction="sequential_hcl", colorFunctionOption="flatter") likert(ProfDiv, horizontal=FALSE, positive.order=FALSE) likert(ProfDiv, horizontal=FALSE, positive.order=FALSE, colorFunctionOption="default") likert(ProfDiv, horizontal=FALSE, positive.order=FALSE, colorFunctionOption="flatter") likert(ProfDiv, horizontal=FALSE, positive.order=FALSE, colorFunction="sequential_hcl") likert(ProfDiv, horizontal=FALSE, positive.order=FALSE, colorFunction="sequential_hcl", colorFunctionOption="default") likert(ProfDiv, horizontal=FALSE, positive.order=FALSE, colorFunction="sequential_hcl", colorFunctionOption="flatter") likertMosaic(ProfDiv.df) likertMosaic(ProfDiv.df, colorFunctionOption="default") likertMosaic(ProfDiv.df, colorFunctionOption="flatter") likertMosaic(ProfDiv.df, colorFunction="sequential_hcl") likertMosaic(ProfDiv.df, colorFunction="sequential_hcl", colorFunctionOption="default") likertMosaic(ProfDiv.df, colorFunction="sequential_hcl", colorFunctionOption="flatter") ## specify an hcl palette for use with the likert functions. BlueOrange <- likertColor(nc=4, ReferenceZero=NULL, colorFunction="diverge_hcl", colorFunctionArgs= list(h=c(246, 40), c=96, l=c(65,90), power=1.5)) likert( ~ . , ProfDiv.df, horizontal=FALSE, positive.order=FALSE, col=BlueOrange) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.