Description Usage Arguments Details See Also Examples
Diverging color gradients for the illustration of correlation strength.
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 | scale_color_corr(
...,
option = c("A", "B", "C", "D"),
limits = c(-1, 1),
na.value = "#55FF55",
guide = guide_colorbar(title = "Correlation"),
aesthetics = "colour",
direction = 1
)
scale_colour_corr(
...,
option = c("A", "B", "C", "D"),
limits = c(-1, 1),
na.value = "#55FF55",
guide = guide_colorbar(title = "Correlation"),
aesthetics = "colour",
direction = 1
)
scale_fill_corr(
...,
option = c("A", "B", "C", "D"),
limits = c(-1, 1),
na.value = "#55FF55",
guide = guide_colorbar(title = "Correlation"),
aesthetics = "fill",
direction = 1
)
|
... |
arguments passed to continuous scale |
option |
character in c("A", "B", "C", "D") specifying the desired color scale. Defaults to "A". |
limits |
Limits of the color gradient By default, the limits are set to c(-1, 1), and it is likely not a wise idea to change it as it might over-emphasise weak correlations. |
na.value |
the color to use for missing values. Defaults to '#55FF55'. |
guide |
Type of legend ("colourbar" for continuous legend, "legend"
for legend with discrete values, or a |
aesthetics |
Character string or vector of character strings with the
aesthetics linked to the scale. Defaults to "color" for
|
direction |
Numeric indicating the order of the scale. Defaults to 1; negative values reverse the order of the scale. |
The color and fill scales specified via option
are built upon
ggplot2::scale_colour_gradient2()
and [ggplot2::scale_fill_gradient2(),
which can easily be used to set up additional scales if the available
options are not sufficient.
ggplot2::scale_colour_gradient2()
- basic colour gradient scales
ggplot2::scale_fill_gradient2()
- basic fill gradient scales
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
if(interactive()){
# drosera data with conditional coloring by correlation strength
ggcorrm(drosera) +
lotri(geom_point(aes(col = .corr), alpha = 0.6)) +
lotri(geom_smooth(aes(fill = .corr, col = .corr),
method = "lm", size = 0.3, alpha = 0.6)) +
utri_corrtext(aes(color = .corr)) +
dia_density(fill = "grey80", lower = .4) +
dia_names(y_pos = .1) +
scale_color_corr(option = "A", aesthetics = c("fill", "color"))
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.