Awesome
morris.js for R - 0.2.4
This package is an interface to the morris.js charting library.
Installation
devtools::install_github("tutuchan/morrisjs")
Examples
Line chart
morrisjs(mdeaths) %>%
mjsLine()
Bar chart
morrisjs(mdeaths) %>%
mjsBar()
Area chart
morrisjs(mdeaths) %>%
mjsArea()
Donut chart
morrisjs(list(c("Label 1", "Label 2"), c(10, 20))) %>%
mjsDonut()
Inputs
For lines, areas and bars, inputs can be either ts
, xts
or mts
:
morrisjs(mdeaths) %>%
mjsLine()
morrisjs(ts.union(fdeaths, mdeaths)) %>%
mjsLine()
They can also be data.frame
s or tbl_df
s with the first column being of class Date
:
df <- tibble::tibble(date = as.Date(c("2011-01-01", "2011-02-01", "2011-03-01")),
series1 = rnorm(3), series2 = rnorm(3))
morrisjs(df) %>%
mjsLine()
For donuts, inputs should be a list of two elements: a vector of characters and a vector of numerics.
Options
All options are listed on the morris.js github page and can be passed as parameters to the mjs*
functions.