plotPalette | R Documentation |
Plot a color palette from a data frame. This function takes a vector of colours or a data frame with a column of colors and plots the colors as a color palette.
plotPalette(df, color_col)
df |
A vector of colours or a data frame containing a column with colors in hexadecimal format. |
color_col |
A character string representing the name of the column containing the colors. |
A ggplot2 plot object displaying the color palette.
# Create a sample data frame with colors
colors_df <- data.frame(
color = c("#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF")
)
# Plot the color palette with default bar height
plotPalette(colors_df, "color")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.