mjs_histogram: Plot Histograms with MetrisGraphics

Description Usage Arguments Value Examples

Description

Given a numeric vector or a data frame and numeric column name (bare or quoted), plot a histogram with the specified parameter. This function automatically a y axis label "Frequency" which you can override with a call to mjs_labs.

Usage

1
mjs_histogram(mjs, bar_margin = 1, bins = NULL)

Arguments

mjs

metricsgraphics plot object

bar_margin

space between bars (defaults to 1)

bins

numbenr of bins for the histogram (NULL == let MetricsGraphcis.js library compute)

Value

metricsgraphics plot object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
movies <- ggplot2movies::movies[sample(nrow(ggplot2movies::movies), 1000), ]

mjs_plot(movies$rating) %>% mjs_histogram()

mjs_plot(movies, rating) %>%
  mjs_histogram() %>%
  mjs_labs(x_label="Histogram of movie ratings")

mjs_plot(movies$rating) %>%
  mjs_histogram(bins=30)

mjs_plot(runif(10000)) %>%
  mjs_histogram() %>%
  mjs_labs(x_label="runif(10000)")

Example output



metricsgraphics documentation built on May 1, 2019, 8:07 p.m.