scale_manual | R Documentation |
These functions allow you to specify your own set of mappings from levels in the data to aesthetic values.
scale_shadowcolour_manual( ..., values, aesthetics = "shadowcolour", breaks = waiver() )
... |
Arguments passed on to
|
values |
a set of aesthetic values to map data values to. The values will be matched in order (usually alphabetical) with the limits of the scale, or with 'breaks' if provided. If this is a named vector, then the values will be matched based on the names instead. Data values that don't match will be given 'na.value'. |
aesthetics |
Character string or vector of character strings listing the name(s) of the aesthetic(s) that this scale works with. This can be useful, for example, to apply colour settings to the 'colour' and 'fill' aesthetics at the same time, via 'aesthetics = c("colour", "fill")'. |
breaks |
One of: - 'NULL' for no breaks - 'waiver()' for the default breaks (the scale limits) - A character vector of breaks - A function that takes the limits as input and returns breaks as output |
The functions 'scale_colour_manual()', 'scale_fill_manual()', 'scale_size_manual()', etc. work on the aesthetics specified in the scale name: 'colour', 'fill', 'size', etc. However, the functions 'scale_colour_manual()' and 'scale_fill_manual()' also have an optional 'aesthetics' argument that can be used to define both 'colour' and 'fill' aesthetic mappings via a single function call (see examples). The function 'scale_discrete_manual()' is a generic scale that can work with any aesthetic or set of aesthetics provided via the 'aesthetics' argument.
a scale object to add to a plot.
Many color palettes derived from RGB combinations (like the "rainbow" color palette) are not suitable to support all viewers, especially those with color vision deficiencies. Using 'viridis' type, which is perceptually uniform in both colour and black-and-white display is an easy option to ensure good perceptive properties of your visulizations. The colorspace package offers functionalities - to generate color palettes with good perceptive properties, - to analyse a given color palette, like emulating color blindness, - and to modify a given color palette for better perceptivity.
For more information on color vision deficiencies and suitable color choices see the [paper on the colorspace package](https://arxiv.org/abs/1903.06490) and references therein.
library( ggplot2 ) p <- ggplot(mtcars, aes(wt, mpg, shadowcolour=as.factor(gear))) p <- p + geom_glowpoint() + guides(shadowcolour='none') p + scale_shadowcolour_manual(values=c('red', 'blue', 'green'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.