Skip to contents

Quick bar chart from x/y data.

Usage

draw_bar(
  x,
  y,
  color = NULL,
  stack = FALSE,
  horizontal = FALSE,
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  theme = NULL,
  margins = NULL,
  width = NULL,
  height = NULL,
  filename = NULL
)

Arguments

x

Character: Category labels.

y

Numeric or named list: Bar heights.

color

Optional Character: Bar color or colors. For multiple series, colors are applied per series and recycled as needed. For a single series, a single color styles the whole series; multiple colors are recycled across individual bars. color takes precedence over the theme palette.

stack

Logical: Whether to stack bars.

horizontal

Logical: Whether to draw horizontal bars.

xlab

Optional Character: X-axis title (bottom axis).

ylab

Optional Character: Y-axis title (left axis).

title

Optional Character: Chart title.

theme

Optional Theme: Theme override. The palette inside the theme can be overridden per-chart with the color argument.

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.