On many of my images thus far, I have been using the viridis colour palette - Option G (or Mako).
I've been using functions to select from the palette, such as scale_fill_viridis_d(option = "G")
.
However, I'd like to sample from this palette and therefore I'd like to identify the underlying colour codes.
Could anyone tell me how to identify the codes characterising Mako/Option G. So far, the function below has not worked.
Would appreciate all help.
#NOT WORKED.
#I TRIED EXPANDING PARAMETER VALUES/CHANGING 'VIRIDIS' FUNCTION. YET, NO SUCCESS.
library(viridis)
library(scales)
show_col(viridis_pal()(12))
Try:
viridis_pal(option = "G")(12)
# [1] "#0B0405FF" "#231526FF" "#35264CFF" "#403A75FF" "#3D5296FF" "#366DA0FF"
# [7] "#3487A6FF" "#35A1ABFF" "#43BBADFF" "#6CD3ADFF" "#ADE3C0FF" "#DEF5E5FF"
Example:
#some plot with fill
ggplot(mtcars, aes(wt, mpg, fill = factor(cyl))) +
geom_point(size = 4, shape = 21) +
scale_fill_viridis_d(option = "G")
#get the codes used for above plot
viridis_pal(option = "G")(3)
# [1] "#0B0405FF" "#357BA2FF" "#DEF5E5FF"
#visualise the colours
show_col(viridis_pal(option = "G")(3))