plot_colors {colorfindr}R Documentation

Create treemaps of image color compositions

Description

plot_colors creates a treemap of colors extracted from Windows BMP, JPEG, PNG, TIFF, and SVG format images with the get_colors function.

Usage

plot_colors(data, sort = "color", labels = TRUE)

Arguments

data

a data.frame from a get_colors call consisting of the columns col_hex, col_freq, col_share.

sort

specifies the sorting of the treemap rectangles. By default ("color"), the rectangles are sorted by hex color codes, starting in the upper left corner. With ("size") the largest rectangle is placed top left.

labels

by default, rectangles that are sufficiently large are provided with a label. If FALSE, then no labels are displayed.

Examples

# Extract all colors
pic1 <- system.file("extdata", "pic1.png", package = "colorfindr")
col <- get_colors(pic1)

# Plot image composition
plot_colors(col)


[Package colorfindr version 0.1.4 Index]