Skip to contents

Histogram from numeric data, with optional grouping for multiple traces. Bins are computed using graphics::hist() with consistent break points across groups.

Usage

draw_histogram(
  x,
  group = NULL,
  breaks = "Sturges",
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  theme = NULL,
  margins = NULL,
  width = NULL,
  height = NULL,
  filename = NULL
)

Arguments

x

Numeric: Values used for histogram binning.

group

Optional Vector: Grouping variable for multiple series.

breaks

Numeric, Character, or Numeric vector: Binning method. A single number (number of bins), a character string naming an algorithm (e.g. "Sturges", "Scott", "FD"), or a numeric vector of break points. Passed to graphics::hist().

xlab

Optional Character: X-axis title.

ylab

Optional Character: Y-axis title.

title

Optional Character: Chart title.

theme

Optional Theme: Theme override.

margins

Optional Named numeric vector or named list: Plot margins in pixels (or percentage strings) for any of "top", "right", "bottom", "left". Unspecified sides keep echarts' default auto-sizing. See draw_line() for details.

width

Optional Character or Numeric: Widget width.

height

Optional Character or Numeric: Widget height.

filename

Optional Character: If provided, save the widget to this file via save_drawing().

Value

htmlwidget: Widget object.