waffle_icon: Waffle plot with icons

View source: R/waffle.R

waffle_iconR Documentation

Waffle plot with icons

Description

Waffle plot with icons

Usage

waffle_icon(
  values,
  colors,
  icons,
  ncol = 10,
  nrow = 10,
  flow = c("row", "column"),
  legend = TRUE,
  width = NULL
)

Arguments

values

A vector of values to be plotted.

colors

Colors to use for each unique values.

icons

Icon or list of icons associated to unique values.

ncol, nrow

Number of column and row in the matrix.

flow

Populate matrix by rows or columns.

legend

Logical, display or not a legend.

width

Width of the matrix.

Value

HTML tags.

Examples

library(phosphoricons)

waffle_icon(
  values = sort(sample(c("Aa", "Bb", "Cc"), 100, TRUE)),
  colors = c("#81F4E1", "#56CBF9", "#FF729F"),
  icons = ph("user", weight = "fill", height = 32)
)

waffle_icon(
  values = sample(c("Cats", "Dogs"), 200, TRUE),
  colors = list(
    Cats = "#456990",
    Dogs = "#F45B69"
  ),
  icons = list(
    Cats = ph("cat", height = NULL),
    Dogs = ph("dog", height = NULL)
  ),
  ncol = 15,
  nrow = 8,
  width = "500px"
)

phosphoricons documentation built on May 29, 2024, 2:07 a.m.