Create an animated histogram.

animatedHistogram(
  x,
  bins = 30,
  duration = 2000,
  delay = 100,
  fill = "crimson",
  xFontSize = 10,
  yFontSize = 10,
  xticks = NULL,
  yticks = NULL,
  xtitle = NULL,
  xtitleFontSize = 16,
  ytitle = NULL,
  ytitleFontSize = 16,
  title = NULL,
  titleFontSize = 22,
  stroke = "crimson",
  strokeWidth = NULL,
  font = "Verdana, Geneva, Tahoma, sans-serif",
  bgcol = "#CAD0D3",
  opacity = 1,
  axisCol = "black",
  width = NULL,
  height = NULL
)

Arguments

x

A vector of data.

bins

The number of bins to consider. Defaults to 30.

duration

The duration of the bars' transition in milliseconds. Defaults to 2000.

delay

The amount of time (in milliseconds) that precedes before triggering the appearance of each bar. Defaults to 100.

fill

The color of the bars. Defaults to 'crimson'.

xFontSize

the font size of the x-axis labels. Defaults to 10.

yFontSize

the font size of the y-axis labels. Defaults to 10.

xticks

Optional. the number of x-axis ticks to consider.

yticks

Optional. The number of y-axis ticks to consider.

xtitle

Optional. The title of the x-axis.

xtitleFontSize

The font size of the x-axis title. Defaults to 16.

ytitle

Optional. The title of the y-axis.

ytitleFontSize

The font size of the y-axis title. Defaults to 16.

title

Optional. The title of the plot.

titleFontSize

The font size of the plot title. Defaults to 22.

stroke

The stroke color of the bars. Defaults to 'crimson'.

strokeWidth

Optional. the stroke width of the bars.

font

The font family to consider for the titles. Defaults to "Verdana, Geneva, Tahoma, sans-serif".

bgcol

The background color of the SVG. Defaults to "#CAD0D3" HEX color.

opacity

The color opacity of the bars (from 0 to 1). Defaults to 1.

axisCol

the color of the x and y axis. It includes the ticks, the labels and titles. Defaults to 'black'.

width

Optional. The width of the SVG output.

height

Optional. The height of the SVG output.

Value

An animated SVG histogram.

Examples

animatedHistogram( x = mpg$hwy, duration = 2000, delay = 100 )
#> Error in r2d3::r2d3(data = data, script = system.file("d3/scatterplot/animatedhistogram.js", package = "ddplot"), options = list(x = x, bins = bins, fill = fill, xticks = xticks, yticks = yticks, xtitle = xtitle, ytitle = ytitle, title = title, font = font, stroke = stroke, strokeWidth = strokeWidth, width = width, height = height, xFontSize = xFontSize, yFontSize = yFontSize, xtitleFontSize = xtitleFontSize, ytitleFontSize = ytitleFontSize, titleFontSize = titleFontSize, bgcol = bgcol, opacity = opacity, axisCol = axisCol, duration = duration, delay = delay)): object 'mpg' not found