GetVectorOfColors: Identify colors for creating a chart with specified input...

GetVectorOfColorsR Documentation

Identify colors for creating a chart with specified input data.

Description

This function takes into account a range of parameters including the chart type and other charting parameters, visualization template, and other colors specified through the palette.

Usage

GetVectorOfColors(
  template,
  input.data,
  filter,
  chart.type,
  scatter.colors.column = FALSE,
  multi.color.series = FALSE,
  palette = NULL,
  palette.custom.color = NULL,
  palette.custom.gradient.start = NULL,
  palette.custom.gradient.end = NULL,
  palette.custom.palette = NULL,
  color.values = NULL,
  small.multiples = FALSE,
  type = "Series"
)

Arguments

template

A list specifying color palettes and other visualization options.

input.data

Input data for the visualization. The is usually a vector or table. It should be normalized from flipChart::PrepareData.

filter

Optional filter which can be used with the input data. The label of the filter is used when appropriate.

chart.type

Type of chart to plot

scatter.colors.column

For scatterplot data, the column of data which is used to determine the colors of each point.

multi.color.series

For bar and column charts, a logical indicating how colors are used. By default, this value is set to FALSE, in which case the number of colors returned is equal to the number of data series (or columns) in data. When multi.color.series == TRUE, multiple colors are assigned to the categories within a single data series, so the number of colors returned is equal to NROW(data).

palette

Specifies the color vector to output. It can be; (1) A named palette from grDevices, RColorBrewer colorspace, or colorRamps; (2) "Group colors" - this option returns a value of NULL so that the charts will use defaults specified instead the charting function. It is usually only applicable for the line of best fit (i.e. apply the colors for each data series to their respective live of best fit), or Pie subslice (create a gradient for the subslices based centered on the color of the main (inner) slice. No checks are applied because this option is only made available in the GUI controls when this option is relevant. (3) A vector of colors which will be recycled to length number.colors.needed; or (4) one of "Custom color", "Custom gradient" or "Custom palette". The last option gives the user greater control via additional parameters (see below). If not specified, the colors used are c("#5C9AD3", "#ED7D31", "#A5A5A5", "#FFC000", "#4473C5", "#70AD46", "#255F91", "#9E480D", "#636365", "#987300", "#26408B", "#42682B")

palette.custom.color

A single color provided as a hex or character string. Only used if palette is "Custom color". The output vector will consist of custom.color repeated to the desired length (no interpolation).

palette.custom.gradient.start

A color specifying the start of the gradient when palette is set to "Custom gradient".

palette.custom.gradient.end

A color specifying the end of the gradient when palette is set to "Custom gradient".

palette.custom.palette

A vector or comma separated list of colors which will be recycled to the desired length unless color.values is provided in which case the whole vector will be used to construct a color scale.

color.values

An optional numeric vector or matrix which can be used with gradual palettes (either a custom gradient or one of the sequential color palettes). The names of the vector or matrix should be the same as the names of input.data, and the colorramp is constructed across the range of the values.

small.multiples

Logical indicating whether the color.values are being applied to for small multiples (a matrix of colors is created instead of a vector)

type

Describes the type of data which the color vector will be applied to. One of "Series" or "Pie subslice". By default, type is set to "Series", in which case the return value assigns a different color for each data series. When chart.type == "Pie", type can be set to "Pie subslice" and the return value assigns a color for each subslice of the Pie.

Value

A vector or matrix of colors (as hex codes) with the appropriate number of colors taking into account the input.data, chart.type, the template and other parameters.


NumbersInternational/flipChartBasics documentation built on Feb. 26, 2024, 5:34 a.m.