PictographChart: Create chart of pictographs

View source: R/pictographchart.R

PictographChartR Documentation

Create chart of pictographs

Description

PictographChart Create a chart to visually represent the data in a table or vector using the number of icons displayed

PictoStdChart Deprecated function for backwards-compatibility

Usage

PictographChart(
  x,
  image = "stickman",
  base.image = "",
  is.custom.url = FALSE,
  hide.base.image = FALSE,
  total.icons = NA,
  scale = NA,
  mode = "table",
  icon.palette = "Strong colors",
  icon.colors = "black",
  icon.custom.color = NA,
  icon.custom.gradient.start = NA,
  icon.custom.gradient.end = NA,
  icon.custom.palette = NA,
  fill.direction = "fromleft",
  show.lines = FALSE,
  layout = NA,
  icon.nrow = 1,
  icon.ncol = NA,
  fix.icon.nrow = TRUE,
  table.by.row = FALSE,
  row.names.to.remove = "",
  column.names.to.remove = "",
  show.legend = FALSE,
  legend.text = "",
  legend.icon.color = NA,
  pad.legend = 40,
  hide.label.right = TRUE,
  hide.label.left = !hide.label.right,
  hide.label.bottom = (mode != "column"),
  hide.label.top = (mode == "column"),
  label.color.asIcon = FALSE,
  label.left = NA,
  label.top = NA,
  label.bottom = NA,
  label.right = NA,
  label.pad = 0,
  label.left.pad = label.pad,
  label.right.pad = label.pad,
  label.bottom.align.horizontal = "center",
  label.left.align.horizontal = "default",
  label.right.align.horizontal = "default",
  label.top.align.horizontal = "center",
  label.left.align.vertical = ifelse(is.na(icon.ncol[1]), "center", "top"),
  label.top.align.vertical = "center",
  label.right.align.vertical = ifelse(is.na(icon.ncol[1]), "center", "top"),
  label.bottom.align.vertical = "center",
  width.height.ratio = NA,
  label.top.height = NA,
  label.font.family = "arial",
  label.font.size = 12,
  label.font.color = "#2C2C2C",
  label.left.font.color = label.font.color,
  label.right.font.color = label.font.color,
  label.top.font.color = label.font.color,
  label.bottom.font.color = label.font.color,
  label.left.font.size = label.font.size,
  label.top.font.size = label.font.size,
  label.right.font.size = label.font.size,
  label.bottom.font.size = label.font.size,
  label.left.font.weight = "normal",
  label.top.font.weight = "normal",
  label.bottom.font.weight = "normal",
  label.right.font.weight = "normal",
  show.label.data = FALSE,
  customize.label.data = TRUE,
  label.data.digits = 0,
  label.data.bigmark = ",",
  label.data.prefix = "",
  label.data.suffix = "",
  label.data.100prc = FALSE,
  label.data.position = ifelse(mode == "bar", "Next to bar", "footer"),
  label.data.font.weight = "normal",
  label.data.font.size = 0.8 * label.font.size,
  label.data.font.color = label.font.color,
  label.data.align.horizontal = "default",
  label.data.type = "None",
  data.above.label = FALSE,
  ...
)

PictoStdChart(...)

Arguments

x

Data to plot. Can be vector, matrix or data.frame.

image

Name of icon (e.g. "star", "stickman",...) or URL to icon image if is.custom.url.

base.image

URL of image to use as base image. Only used if is.custom.url = TRUE and hide.base.image = FALSE.

is.custom.url

Whether the image parameter is a url supplied by the user.

hide.base.image

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

total.icons

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

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.

mode

Can be set to one of "table", "bar", "column". For options bar and column, the chart is constrained to look like a bar or column chart. e.g For mode = "column", 1-dimensional vectors/matrices are re-shaped to have multiple columns, labels are put below the graphis and icons are arranged vertically. Option mode = "table" is the most general and does not impose constraints.

icon.palette

Name of palette used to color icons. Only applicable for in-built icons

icon.colors

Vector of colors for icons. Only applicable when icon.palette = "Custom color" or "Custom palette" and in-built icons used (Deprecated).

icon.custom.color

A single color which is used if icon.palette is set to "Custom color".

icon.custom.gradient.start

Character; starting color of gradient if icon.palette is set to "Custom gradient".

icon.custom.gradient.end

Character; last color of gradient if icon.palette is set to "Custom gradient".

icon.custom.palette

Character; comma separated list of colors to be used if icon.palette is set to "Custom palette".

fill.direction

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

show.lines

Add horizontal lines between each row

layout

May be one of "Number of rows" or "Number of columns". This parameter controls how the configuration of icons is specified. If no string is supplied, it will be automatically determined depending on whether icon.nrow or icon.ncol is supplied.

icon.nrow

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

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.

table.by.row

By default, when a 2-dimensional table is supplied, values in each column will be shown in the same color. Set to TRUE to color values by row.

row.names.to.remove

List of rownames to exclude from the chart. This can be in the form of a vector or a comma-separated string. This variable is ignored if the input data has no rownames.

column.names.to.remove

List of colnames to exclude from the chart.

show.legend

Show legend (true or false).

legend.text

Text shown with legend. If this string is empty, it will be automatically filled in using scale. (To hide text completely, use legend.text = " ")

legend.icon.color

Color of icon shown in legend.

pad.legend

Horizontal spacing between the chart and the legend.

hide.label.right

Suppress labels on right of graphics.

hide.label.left

Suppress labels on left of graphics. By default, if label.left is not supplied, labels are taken from the rownames of x.

hide.label.bottom

Suppress labels below graphics (shown by default when mode = "column").

hide.label.top

Suppress labels above graphics.

label.color.asIcon

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

label.left

Length must be equal to length (if x is a vector) or number of rows (if x is matrix or data.frame) as x. If no value is supplied, labels will be read from names/rowname of x. To suppress labels, use label.left = NULL.

label.top

By default, labels are read from column names of x.

label.bottom

Optional labels below graphic cells. The length of the labels must be the same as the number of columns in x.

label.right

Optional labels to the right of graphic cells. The length of the labels must be the same as the number of rows in x.

label.pad

Numeric specifying padding around the labels. Alternatively, the user can individually specify label.left.pad (horizontal space between left row label and icons), label.right.pad (horizontal space between right row label and icons).

label.left.pad

Horizontal spacing between row labels and icons.

label.right.pad

Horizontal spacing between row labels and icons.

label.bottom.align.horizontal

Horizontal alignment of row and column labels. One of "left", "right" or "center".

label.left.align.horizontal

Horizontal alignment of row and column labels. One of "left", "right" or "center".

label.right.align.horizontal

Horizontal alignment of row and column labels. One of "left", "right" or "center".

label.top.align.horizontal

Horizontal alignment of row and column labels. One of "left", "right" or "center".

label.left.align.vertical

Vertical alignment of row and column labels. One of "top", "bottom" or "center".

label.top.align.vertical

Vertical alignment of row and column labels. One of "top", "bottom" or "center".

label.right.align.vertical

Vertical alignment of row and column labels. One of "top", "bottom" or "center".

label.bottom.align.vertical

Vertical alignment of row and column labels. One of "top", "bottom" or "center".

width.height.ratio

Width-to-height ratio used to adjust row heights and column widths so they match the aspect ratio of the icon. Mis-specfication does not distort icon, but graphic will have extra spacing. When set to zero, row.height and column.width are unchanged, otherwise initial values are decreased to match width.height.ratio.

label.top.height

Height of top label row in pixels.

label.font.family

Controls font-family of all labels. To modify only the font of one label use label.left.font.family, label.top.font.family, etc.

label.font.size

Size of label text.

label.font.color

Colour of labels. This can be a string or a 6-digit hex code.

label.left.font.color

Font color of row/column labels which overrides the global label.font.color setting.

label.right.font.color

Font color of row/column labels which overrides the global label.font.color setting.

label.top.font.color

Font color of row/column labels which overrides the global label.font.color setting.

label.bottom.font.color

Font color of row/column labels which overrides the global label.font.color setting.

label.left.font.size

Font size of row/column labels which overrides the global label.font.size setting.

label.top.font.size

Font size of row/column labels which overrides the global label.font.size setting.

label.right.font.size

Font size of row/column labels which overrides the global label.font.size setting.

label.bottom.font.size

Font size of row/column labels which overrides the global label.font.size setting.

label.left.font.weight

Font weight of row/column labels which overrides the global label.font.weight setting.

label.top.font.weight

Font weight of row/column labels which overrides the global label.font.weight setting.

label.bottom.font.weight

Font weight of row/column labels which overrides the global label.font.weight setting.

label.right.font.weight

Font weight of row/column labels which overrides the global label.font.weight setting.

show.label.data

Boolean indicating whether or not to show data labels.

customize.label.data

Boolean indicating whether of not users want to customize data labels. By default this is on, but when set to FALSE, parameters label.data.digits, label.data.100prc, label.data.prefix, label.data.suffix is ignored.

label.data.digits

Number of digits to show after decimal place.

label.data.bigmark

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

label.data.prefix

String to prepend data label.

label.data.suffix

String to append to data label.

label.data.100prc

Option to show data labels multiplied by 100. This is useful when reporting percentages.

label.data.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

label.data.font.weight

Weight of data labels, i.e. one of "bold" or "normal".

label.data.font.size

Font size of data labels.

label.data.font.color

Font color of data labels.

label.data.align.horizontal

Horizontal alignment of data labels.

label.data.type

Does nothing. Retained for backwards compatibility.

data.above.label

Set to TRUE, to place data labels above row labels.

...

Arguments to pass to pictoChart

Examples

xx <- c(First = 3, Second = 6, Third=2)
PictographChart(xx, image="circle", mode="bar")
PictographChart(xx, image="elephant", hide.base.image=TRUE, show.label.data=TRUE, mode="bar")
PictographChart(xx, total.icons=10, mode="bar", fill.direction="fromright", is.custom.url=TRUE,
   image="http://wiki.q-researchsoftware.com/images/a/a9/Stick_woman_dark_red.png",
   base.image="http://wiki.q-researchsoftware.com/images/7/78/Stick_man_light_grey.png")

NumbersInternational/flipPictographs documentation built on Feb. 26, 2024, 5:38 a.m.