# Objects of class `palettes_colour` are plotted as swatches.
x <- pal_colour(c("darkslateblue", "cornflowerblue", "slategray1"))
plot(x)
# Objects of class `palettes_palette` with one palette are plotted with
# the palette name spanned across the swatches.
y <- pal_palette(Egypt = c("#DD5129", "#0F7BA2", "#43B284", "#FAB255"))
plot(y)
# Objects of class `palettes_palette` with multiple palettes are faceted.
z <- pal_palette(
Egypt = c("#DD5129", "#0F7BA2", "#43B284", "#FAB255"),
Java = c("#663171", "#CF3A36", "#EA7428", "#E2998A", "#0C7156")
)
plot(z)
# Colours can also be interpolated.
plot(x, n = 5)
plot(y, n = 5)
plot(z, n = 5)
Run the code above in your browser using DataLab