Learn R Programming

phosphoricons (version 0.2.1)

waffle_icon: 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
)

Value

HTML tags.

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.

Examples

Run this code
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"
)

Run the code above in your browser using DataLab