Debian Codegraph @

man/choose_palette.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/choose_palette.R
3 \name{choose_palette}
4 \alias{choose_palette}
5 \alias{hclwizard}
6 \alias{hcl_wizard}
7 \title{Graphical User Interface for Choosing HCL Color Palettes}
8 \usage{
9 choose_palette(pal = diverging_hcl, n = 7L, parent = NULL, gui = "tcltk", ...)
10
11 hclwizard(n = 7L, gui = "shiny", ...)
12 }
13 \arguments{
14 \item{pal}{function; the initial palette, see \sQuote{Value} below. Only
15 used if \code{gui = "tcltk"}.}
16
17 \item{n}{integer; the initial number of colors in the palette.}
18
19 \item{parent}{tkwin; the GUI parent window. Only used if \code{gui =
20 "tcltk"}.}
21
22 \item{gui}{character; GUI to use. Available options are \code{tcltk} and
23 \code{shiny}, see \sQuote{Details} below.}
24
25 \item{...}{used for development purposes only.}
26 }
27 \value{
28 Returns a palette-generating function with the selected arguments.
29 Thus, the returned function takes an integer argument and returns the
30 corresponding number of HCL colors by traversing HCL space through
31 interpolation of the specified hue/chroma/luminance/power values.
32 }
33 \description{
34 A graphical user interface (GUI) for viewing, manipulating, and choosing HCL
35 color palettes.
36 }
37 \details{
38 Computes palettes based on the HCL (hue-chroma-luminance) color model (as
39 implemented by \code{\link{polarLUV}}). The GUIs interface the palette
40 functions \code{\link{qualitative_hcl}} for qualitative palettes,
41 \code{\link{sequential_hcl}} for sequential palettes with a single or
42 multiple hues, and \code{\link{diverging_hcl}} for diverging palettes (composed
43 from two single-hue sequential palettes).
44
45 Two different GUIs are implemented and can be selected using the function
46 input argument \code{gui} (\code{"tcltk"} or \code{"shiny"}). Both GUIs
47 allows for interactive modification of the arguments of the respective
48 palette-generating functions, i.e., starting/ending hue (wavelength, type of
49 color), minimal/maximal chroma (colorfulness), minimal maximal luminance
50 (brightness, amount of gray), and a power transformations that control how
51 quickly/slowly chroma and/or luminance are changed through the palette.
52 Subsets of the parameters may not be applicable depending on the type of
53 palette chosen. See \code{\link{qualitative_hcl}} and Zeileis et al. (2009, 2019) for
54 a more detailed explanation of the different arguments. Stauffer et al.
55 (2015) provide more examples and guidance.
56
57 Optionally, active palette can be illustrated by using a range of examples
58 such as a map, heatmap, scatter plot, perspective 3D surface etc.
59
60 To demonstrate different types of deficiencies, the active palette may be
61 desaturated (emulating printing on a grayscale printer) and collapsed to
62 emulate different types of color-blindness (without red-green or green-blue
63 contrasts) using the \code{\link{simulate_cvd}} functions.
64
65 \code{choose_palette} by default starts the Tcl/Tk version of the GUI while
66 \code{hclwizard} by default starts the shiny version. \code{hcl_wizard} is
67 an alias for \code{hclwizard}.
68 }
69 \examples{
70 if(interactive()) {
71 ## Using tcltk GUI
72 pal <- choose_palette()
73 ## or equivalently: hclwizard(gui = "tcltk")
74
75 ## Using shiny GUI
76 pal <- hclwizard()
77 ## or equivalently: choose_palette(gui = "shiny")
78
79 ## use resulting palette function
80 filled.contour(volcano, color.palette = pal, asp = 1)
81 }
82 }
83 \references{
84 Zeileis A, Hornik K, Murrell P (2009). Escaping RGBland:
85 Selecting Colors for Statistical Graphics. \emph{Computational Statistics &
86 Data Analysis}, \bold{53}, 3259--3270.
87 \doi{10.1016/j.csda.2008.11.033}
88 Preprint available from
89 \url{https://www.zeileis.org/papers/Zeileis+Hornik+Murrell-2009.pdf}.
90
91 Stauffer R, Mayr GJ, Dabernig M, Zeileis A (2015). Somewhere over the
92 Rainbow: How to Make Effective Use of Colors in Meteorological
93 Visualizations. \emph{Bulletin of the American Meteorological Society},
94 \bold{96}(2), 203--216.
95 \doi{10.1175/BAMS-D-13-00155.1}
96
97 Zeileis A, Fisher JC, Hornik K, Ihaka R, McWhite CD, Murrell P, Stauffer R, Wilke CO (2020).
98 \dQuote{colorspace: A Toolbox for Manipulating and Assessing Colors and Palettes.}
99 \emph{Journal of Statistical Software}, \bold{96}(1), 1--49. \doi{10.18637/jss.v096.i01}
100 }
101 \seealso{
102 \code{\link{simulate_cvd}}, \code{\link{desaturate}}, \code{\link{qualitative_hcl}}.
103 }
104 \author{
105 Jason C. Fisher, Reto Stauffer, Achim Zeileis
106 }
107 \keyword{misc}