scale_colour_cmocean {cmocean} | R Documentation |
cmocean colour scales for ggplot2
Description
Helper functions to allow the colour scale to be used effectively in ggplot2.
Usage
scale_colour_cmocean(
..., alpha = 1, start = 0, end = 1, direction = 1, discrete = FALSE,
name = "thermal", version = getOption('cmocean-version', '2.0')
)
scale_color_cmocean(
..., alpha = 1, start = 0, end = 1, direction = 1, discrete = FALSE,
name = "thermal", version = getOption('cmocean-version', '2.0')
)
scale_fill_cmocean(
..., alpha = 1, start = 0, end = 1, direction = 1, discrete = FALSE,
name = "thermal", version = getOption('cmocean-version', '2.0')
)
Arguments
... |
parameters to ggplot2 functions |
alpha |
opacity of the palette in the range |
start |
fraction of the colormap to clip from its start, in |
end |
fraction of the colormap where it should stop, in |
direction |
set to |
discrete |
set to |
name |
the name of one of the available cmocean colormaps, see
|
version |
specific |
Value
A ggplot
object to be used with other ggplot
objects.
Author(s)
As requested by Ilja Kocken in https://github.com/aitap/cmocean/issues/5.
See Also
Examples
if (require('ggplot2')) {
dat <- data.frame(
a = 1:10, b = 11:20, c = rnorm(10)
)
ggplot(dat, aes(x = a, y = b, fill = c)) +
geom_raster() + scale_fill_cmocean()
}