Distribution: Distribution

View source: R/distribution.R

DistributionR Documentation

Distribution

Description

Distribution Chart.

Usage

Distribution(
  x,
  weights = NULL,
  vertical = TRUE,
  show.mean = TRUE,
  show.median = TRUE,
  show.quartiles = TRUE,
  show.range = TRUE,
  show.density = TRUE,
  show.mirror.density = TRUE,
  show.values = FALSE,
  density.type = "Density",
  bw = "nrd0",
  adjust = 1,
  kernel = c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight",
    "cosine", "optcosine"),
  n = 512,
  from = NULL,
  to = NULL,
  cut = 3,
  automatic.lower.density = TRUE,
  histogram.cumulative = FALSE,
  histogram.counts = FALSE,
  maximum.bins = NULL,
  box.points = "Suspected outliers",
  mean.color = "White",
  median.color = "Black",
  quartile.color = "Black",
  range.color = "Black",
  values.color = "#008000",
  density.color = "#008000",
  global.font.family = "Arial",
  global.font.color = rgb(44, 44, 44, maxColorValue = 255),
  title = "",
  title.font.family = global.font.family,
  title.font.color = global.font.color,
  title.font.size = 16,
  title.align = "center",
  subtitle = "",
  subtitle.font.family = global.font.family,
  subtitle.font.color = global.font.color,
  subtitle.font.size = 12,
  subtitle.align = "center",
  footer = "",
  footer.font.family = global.font.family,
  footer.font.color = global.font.color,
  footer.font.size = 8,
  footer.align = "center",
  footer.wrap = TRUE,
  footer.wrap.nchar = 100,
  background.fill.color = "transparent",
  background.fill.opacity = 1,
  charting.area.fill.color = background.fill.color,
  charting.area.fill.opacity = 0,
  margin.top = NULL,
  margin.bottom = NULL,
  margin.left = NULL,
  margin.right = NULL,
  grid.show = FALSE,
  values.title = "",
  values.title.font.color = global.font.color,
  values.title.font.family = global.font.family,
  values.title.font.size = 12,
  values.line.width = 0,
  values.line.color = rgb(0, 0, 0, maxColorValue = 255),
  values.tick.mark.color = "transparent",
  values.tick.mark.length = 0,
  values.bounds.minimum = NULL,
  values.bounds.maximum = NULL,
  values.tick.distance = NULL,
  values.tick.maxnum = NULL,
  values.zero = FALSE,
  values.zero.line.width = 0,
  values.zero.line.color = rgb(44, 44, 44, maxColorValue = 255),
  values.grid.width = 1 * grid.show,
  values.grid.color = rgb(225, 225, 225, maxColorValue = 255),
  values.tick.show = TRUE,
  values.tick.suffix = "",
  values.tick.prefix = "",
  values.tick.format = "",
  values.hovertext.format = "",
  values.tick.angle = NULL,
  values.tick.font.color = global.font.color,
  values.tick.font.family = global.font.family,
  values.tick.font.size = 10,
  categories.tick.angle = NULL,
  categories.tick.mark.length = 20,
  categories.tick.font.color = global.font.color,
  categories.tick.font.family = global.font.family,
  categories.tick.font.size = 10,
  categories.tick.label.wrap = TRUE,
  categories.tick.label.wrap.nchar = 21,
  hovertext.font.family = global.font.family,
  hovertext.font.size = 11,
  hover.on = c("all", "points")[1],
  zoom.enable = TRUE,
  tooltip.show = TRUE,
  modebar.show = 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.

weights

An optional list, where each element is a vector containing weights corresponding to the values of x, or, a vector where the weights is assumed applicable for each element in x.

vertical

Display the densities vertically.

show.mean

Displays the mean of the data.

show.median

Displays the median of the data.

show.quartiles

Displays the quartiles of the data.

show.range

Displays the range of the data.

show.density

Show the left or top (if vertical is FALSE) of the violin plot.

show.mirror.density

Show the right or bottom (if vertical is FALSE) of the violin plot.

show.values

Produces a rug plot of individual values.

density.type

Plot the density as a "Density" plot, "Histogram" plot, or "Box" plot. With box plots, the 'whiskers' are drawn at the the most outlying point within 1.5 IQR (inter-quaritle range) below the first quarter and 1.5 IQR above the third quartile.

bw

The smoothing bandwidth to be used when creating a Density, Bean, or Violin plot. This defaults to "nrd0", whereas "SJ" may often be superior (see density). The default is to "nrd0" as "SJ" fails with trivial categorical cases.

adjust

A scaling factor for the bandwidth when creating a Density, Bean, or Violin plot. E.g., a value of 0.5 sets the bandwidth to have of that computed using bw.

kernel

The kernel used when when creating a Density, Bean, or Violin plot. One of "gaussian" (the default), "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine".

n

The number of equally-sapced points at which the density is to be estimated when creating a Density, Bean, or Violin plot. If greater than 512, it is rounded to a power of 2 (see link{density}).

from

The left-most point of the grid used when creating a Density, Bean, or Violin plot.

to

The right-most point of the grid used when creating a Density, Bean, or Violin plot.

cut

By default, the values of from and to are cut bandwidths beyond the extremes of the data.

automatic.lower.density

When TRUE, which is the default, from is set to the lowest value in the data.

histogram.cumulative

Plots the cumulative histogram, if histogram is set to TRUE.

histogram.counts

Displays the counts in tooltips of a histogram, rather than the proportions.

maximum.bins

The maximum number of bins of the histogram. If NULL, this is generated automatically.

box.points

How outliers are displayed boxplots. "All" plots all the points. "Suspected outliers" plots points between 1.5 and 3 IQR from the 1st and 3rd quartile with un-filled circles. "Outliers" does not plot points between 1.5 and 3 IQR from the 1st and 3rd quartiles.

mean.color

Defaults to "white"

median.color

Defaults to "black"

quartile.color

Defaults to "black",

range.color

Defaults to "black"

values.color

Defaults to "Green"

density.color

Defaults to "Green". This can be a single color or a vector of colors, with the same length as the number of variables

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)).

title

Character; chart title.

title.font.family

Character; title font family. Can be "Arial Black", "Arial", "Comic Sans MS", "Courier New", "Georgia", "Impact", "Lucida Console", "Lucida Sans Unicode", "Marlett", "Symbol", "Tahoma", "Times New Roman", "Trebuchet MS", "Verdana", "Webdings"

title.font.color

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

title.font.size

Title font size; default = 10.

title.align

Horizontal alignment of title

subtitle

Character

subtitle.font.family

Character; subtitle font family

subtitle.font.color

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

subtitle.font.size

Integer; subtitle font size

subtitle.align

Horizontal alignment of subtitle

footer

Character

footer.font.family

Character; footer font family

footer.font.color

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

footer.font.size

Integer; footer font size

footer.align

Horizontal alignment of footer

footer.wrap

Logical; whether the footer text should be wrapped.

footer.wrap.nchar

Number of characters (approximately) in each line of the footer when footer.wordwrap TRUE.

background.fill.color

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

background.fill.opacity

Background opacity as an alpha value (0 to 1).

charting.area.fill.color

Charting area background color as a named color in character format (e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, maxColorValue = 255)).

charting.area.fill.opacity

Charting area background opacity as an alpha value (0 to 1).

margin.top

Margin between plot area and the top of the graphic in pixels

margin.bottom

Margin between plot area and the bottom of the graphic in pixels

margin.left

Margin between plot area and the left of the graphic in pixels

margin.right

Margin between plot area and the right of the graphic in pixels

grid.show

Logical; whether to show grid lines.

values.title

Character, y-axis title; defaults to chart input values; to turn off set to "FALSE".

values.title.font.color

y-axis title font color as a named color in character format (e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, max = 255)).

values.title.font.family

Character; y-axis title font family

values.title.font.size

y-axis title font size

values.line.width

y-axis line in pixels, 0 = no line

values.line.color

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

values.tick.mark.color

Color of tick marks.

values.tick.mark.length

Length of tick marks in pixels.

values.bounds.minimum

Minimum of range for plotting; NULL = no manual range set. Must be less than values.bounds.maximum

values.bounds.maximum

Maximum of range for plotting; NULL = no manual range set. Must be greater than values.bounds.minimum

values.tick.distance

The distance between the ticks. Requires that values.bounds.minimum and values.bounds.maximum have been set.

values.tick.maxnum

Maximum number of ticks shown on the values axis.

values.zero

Logical; whether a line should be shown when at values = 0.

values.zero.line.width

Width in pixels of zero line; 0 = no zero line shown

values.zero.line.color

Color of horizontal zero line as a named color in character format (e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, maxColorValue = 255)).

values.grid.width

Width of y-grid lines in pixels; 0 = no line

values.grid.color

Color of y-grid lines as a named color in character format (e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, maxColorValue = 255)).

values.tick.show

Whether to display the y-axis tick labels

values.tick.suffix

y-axis tick label suffix

values.tick.prefix

y-axis tick label prefix

values.tick.format

d3 formatting string applied to the tick labels. See https://github.com/mbostock/d3/wiki/Formatting#numbers

values.hovertext.format

d3 formatting string applied to the hover text. https://github.com/mbostock/d3/wiki/Formatting#numbers or

values.tick.angle

y-axis tick label angle in degrees. 90 = vertical; 0 = horizontal

values.tick.font.color

y-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)).

values.tick.font.family

Character; y-axis tick label font family

values.tick.font.size

y-axis tick label font size

categories.tick.angle

Angle of the categories tick label.

categories.tick.mark.length

Distance between tick labels (variable names) and axis. Note that this parameter name is chosen to be analgous to the same parameter in other charts, but it is not a a true "tick" label so categories.tick.mark.color is set as transparent.

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.family

Character; x-axis tick label font family

categories.tick.font.size

x-axis tick label font size

categories.tick.label.wrap

Logical; whether to wrap long labels on the x-axis.

categories.tick.label.wrap.nchar

Integer; number of characters in each line when categories.tick.label.wrap is TRUE.

hovertext.font.family

Font family of hover text.

hovertext.font.size

Font size of hover text.

hover.on

Only used for boxplot. If "all", then all the hovertext (for median, for the element near the cursor will be shown.

zoom.enable

Logical; whether to enable zoom on the chart. For Bar and Column charts with data labels it may be useful to turn off zoom because data labels and annotations can be misplace on zoom.

tooltip.show

Logical; whether to show a tooltip on hover.

modebar.show

Logical; whether to show the zoom menu buttons or not.

Value

A plotly chart.

Examples

Distribution(rnorm(100))
Distribution(list(rnorm(100), rexp(100)))

Displayr/flipStandardCharts documentation built on Feb. 26, 2024, 12:42 a.m.