Description Usage Arguments Value Examples
This wil create the 'scale_color_' and 'scale_fill_' functions, to be applied in 'ggplot2'. It sets up the color palettes.
1 2 3 | get_scale_color(pal_object)
get_scale_fill(pal_object)
|
pal_object |
The output of the 'get_pal' function. |
palette_list |
The list that contains the character vectors with color codes. List elements should be named. |
A function that can be used to create color scale in an object of class 'ggplot2'. The function has the following parameters:
'palette', a character that indicates which of the color vectors to use.
'alpha', the desired transparancy.
'reverse', if TRUE, the direction of the colours is reversed.
'discrete', whether to use a discrete colour palette.
'...“ additional arguments to pass to scale_color_gradientn
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # devtools::install_github("RopenScilabs/ochRe")
# devtools::install_github("EdwinTh/dutchmasters")
library(ggplot2)
ochRe_pal <- get_pal(ochRe::ochre_palettes)
scale_colour_ochRe <- get_scale_colour(ochRe::ochre_palettes,
ochRe_pal)
dutchmasters_pal <- get_pal(dutchmasters::dutchmasters)
scale_fill_dutchmasters <- get_fill_colour(dutchmasters::dutchmasters,
dutchmasters_pal)
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(colour = factor(cyl)), size = 4) +
scale_colour_ochRe()
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(colour = hp)) +
scale_colour_ochRe(palette = "lorikeet", discrete = FALSE)
ggplot(data = mpg) +
geom_point(mapping = aes(x = displ, y = hwy, color = class)) +
scale_colour_dutchmasters(palette="view_of_Delft")
ggplot(diamonds) + geom_bar(aes(x = cut, fill = clarity)) +
scale_fill_dutchmasters(palette = "anatomy")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.