BarPictograph: Create bar chart composed of icons

View source: R/barpictograph.R

BarPictographR Documentation

Create bar chart composed of icons

Description

Distribution Chart.

Usage

BarPictograph(
  x,
  image = "Stickman",
  custom.image = NULL,
  base.image = "",
  hide.base.image = !any(nzchar(custom.image)),
  base.icon.color = "",
  scale = NA,
  total.icons = NA,
  icon.ncol = NA,
  fix.icon.nrow = TRUE,
  label.color.asIcon = FALSE,
  colors = ChartColors(length(x)),
  fill.direction = c("From left", "From right")[1],
  global.font.family = "Arial",
  global.font.color = rgb(44, 44, 44, maxColorValue = 255),
  data.label.show = FALSE,
  data.label.position = "No",
  data.label.format = "",
  data.label.prefix = "",
  data.label.suffix = "",
  data.label.bigmark = ",",
  data.label.font.family = global.font.family,
  data.label.font.color = global.font.color,
  data.label.font.size = 8,
  data.label.align.horizontal = "Default",
  categories.tick.show = TRUE,
  categories.tick.font.family = global.font.family,
  categories.tick.font.color = global.font.color,
  categories.tick.font.size = 12,
  categories.tick.pad = 5,
  categories.tick.align.horizontal = "Default",
  categories.tick.align.vertical = "Default",
  background.fill.color = "transparent",
  pad.row = 2,
  pad.col = 2,
  pad.icon.row = 0,
  pad.icon.col = 0,
  graphic.width.inch = NA,
  graphic.height.inch = NA,
  graphic.resolution = 72,
  maximum.number.icons = 10000,
  print.config = FALSE
)

Arguments

x

A list, where each vector contains data to be plotted. If the data is not numeric it is coerced to be numeric. Input data may be a matrix or a vector, containing the height of the columns to be plotted, with the name/rownames used as the column names of the chart. Numeric and date labels will be parsed automatically.

image

Name of icon to use.

custom.image

URL of icon to use. If this parameter is supplied image is ignored.

base.image

URL of image to use as base image. Only used if custom.image is supplied.

hide.base.image

Turns off background image. In general, the base image should only be shown if the input data is a proportion.

base.icon.color

Color of base image, supplied as a hex code or string. This is only used if the built-in icons are used.

scale

Value of one icon. If scale = 0, the value is automatically determined from the data so that the largest entry is represented by 10 icons.

total.icons

Maximum number of icons in each table cell. By default, it will be determine based on ceiling(x).

icon.ncol

Configuration of icons in each table cell. Can be a single value or a vector with length equal to the number of columns.

fix.icon.nrow

When mode="bar" and hide.base.image=T, set to FALSE to allow the bars to contain varying number of rows.

label.color.asIcon

When set to TRUE, row and data labels are shown in the same color as the icons.

colors

Character; a vector containing one or more colors specified as hex codes.

fill.direction

Direction in which icons are filled. One of "From left", "From right", "From top", "From bottom".

global.font.family

Character; font family for all occurrences of any font attribute for the chart unless specified individually.

global.font.color

Global font color as a named color in character format (e.g. "black") or an rgb value (e.g. #' rgb(0, 0, 0, maxColorValue = 255)).

data.label.show

Logical; whether to show data labels.

data.label.position

When show.label.data, the position of the data labels can be one of "Above icons", "Below icons" (all modes) or "Next to bar", "Above row label", "Below row label" (bar mode only). Note that the last two options will overrride sublabel.left and sublabel.right.

data.label.format

A string representing a d3 formatting code.

data.label.prefix

Character; prefix for data values.

data.label.suffix

Character; suffix for data values.

data.label.bigmark

Option to prettify large numbers. By default a comma is placed after a thousand.

data.label.font.family

Character; font family for data label.

data.label.font.color

Font color as a named color in character format (e.g. "black") or an a hex code. This can be a single color, a vector of colors (1 for each series/column), or a comma separated list of colors

data.label.font.size

Integer; Font size for data label.px.

data.label.align.horizontal

Horizontal alignment of data labels labels. One of "left", "right", "middle" or "Default".

categories.tick.show

Logical; Whether to show tick labels for each bar (i.e. rownames).

categories.tick.font.family

Character; x-axis tick label font family

categories.tick.font.color

X-axis tick label font color as a named color in character format (e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, maxColorValue = 255)).

categories.tick.font.size

x-axis tick label font size

categories.tick.pad

Horizontal space between the row labels and the icons.

categories.tick.align.horizontal

Horizontal alignment of tick labels for each bar. One of "left", "right", "middle" or "Default".

categories.tick.align.vertical

Vertical alignment of tick labels for each bar. One of "top", "center", "bottom" or "Default".

background.fill.color

Background color in character format (e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, maxColorValue = 255)).

pad.row

Single numeric specifying vertical spacing between graphic cells in the table.

pad.col

Vertical spacing between cells in table.

pad.icon.row

Numeric specifying vertical spacing between icons inside each table cell. May be a single value or a numeric matrix of the same dimensions as x.

pad.icon.col

Horizontal spacing between icons inside each table cell.

graphic.width.inch

Horizontal dimension of the chart output in inches. If these dimensions are not specified, the width-to-height ratio of the chart output may not match the desired dimensions.

graphic.height.inch

Verical dimension of the chart output in inches.

graphic.resolution

Number of pixels per inch. Should not have an actual effect but rounding errors sometimes occur if this is chosen poorly.

maximum.number.icons

Maximum allowed number of icons. Note that increasing this value may cause the browser to crash.

print.config

Print configuration string based to rhtmlPictographs::graphic. This is useful for debugging.

Value

A plotly chart.

Examples

BarPictograph(1:5, image = "Sick person")

NumbersInternational/flipStandardCharts documentation built on Feb. 26, 2024, 5:43 a.m.