Learn R Programming

tidycharts

The goal of tidycharts is to enable R users to create charts inspired by International Business Communication Standards (IBCS). The plots are generated in SVG format, so embedding them in HTML documents is straight forward.

Installation

You can install the released version of tidycharts from CRAN with:

install.packages("tidycharts")

Development version from GitHub can be installed with:

devtools::install_github("MI2DataLab/tidycharts")

Example

How to create IBCS inspired charts using tidycharts?

library(tidycharts) # load the package

# create some data to visualize
df <- data.frame(months = month.abb[1:6],
                 values = round(5 + sin(1:6), 2))

# create chart in a form of character vector containing SVG content
column_chart(df, x = 'months', series = 'values')

You can easily create other type of plots, ie. lineplots:

line_chart_markers(df, x = df$months, series = 'values', series_labels = 'values')

Copy Link

Version

Install

install.packages('tidycharts')

Monthly Downloads

286

Version

0.1.3

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Bartosz Sawicki

Last Published

January 18th, 2022

Functions in tidycharts (0.1.3)

bar_chart_absolute_variance

Generate bar chart with absolute variance.
line_chart

Generates a line plot with markers on chosen points. Allows only one point per time interval. To create a plot with many points within one time interval try `line_chart_dense`.
bar_chart_reference

Generates basic horizontal barchart with index on a given value. If more than one series is supplied, stacked barchart is generated.
bar_chart_normalized

Generates normalized horizontal barchart. If more than one series is supplied, stacked barchart is generated.
add_waterfall_bars

Add waterfall style bars to the column chart
add_title

Add IBCS compliant legend.
add_bars

add bars to svg string
column_chart_waterfall

Generate column waterfall chart for visualizing contribution.
column_chart_relative_variance

Generate column chart with relative variance (in percents).
column_chart_waterfall_variance

Generate column waterfall chart with absolute variance.
draw_triangle

Draw triangle and append it to svg string
set_scatter_colors

Change default colors of the scatter plots from the package.
restore_defaults

Restore default color and style settings.
scatter_plot

Generates a scatter plot. If additional argument added, a bubble plot is generated.
line_chart_dense

Line chart with more points then categories on x-axis.
set_styles

Change default styles for plots.
column_chart_absolute_variance

Generate column chart with absolute variance.
column_chart

Generate basic column chart.
bar_chart

Generates basic horizontal barchart. If more than one series is supplied, stacked barchart is generated.
bar_chart_relative_variance

Generate bar chart with relative variance (in percents).
get_color_stacked

Function to get bar/area color for stacked plots.
bar_chart_waterfall

Generate horizontal waterfall chart.
get_vector

Helper function to get the vector or column form df. If vector is passed it returns it. If name of column is passed, it returns the column as a vector.
SVGrenderer

Function to render SVG image as htmlwidget
join_charts

Join SVG charts.
knit_print.tidychart

Printing in knitr reports
line_chart_normalized

Generates normalized areas (stacked lines) plot. If more than one series is supplied, stacked areas plot is generated.
line_chart_markers_reference

Generates line plot with markers on every value with index on a given value.
set_colors

Change default colors of the package.
column_chart_grouped

Generate grouped column chart for visualizing up to 3 data series.
SVGsave

Save svg image.
column_chart_normalized

Generate column chart with normalization.
show

Function to render SVG as bitmap, used only in tests
set_margins

Set margins size.
line_chart_markers

Generates line plot with markers on every value.
line_chart_dense_custom

More customizable version of `line_chart_dense`. User can choose the points to highlight.
line_chart_stacked

Generates areas (stacked lines) plot. If more than one series is supplied, stacked areas plot is generated.
facet_chart

Facet chart.
print.tidychart

Explicitly draw tidychart
reset_margins

Reset margin values to package defaults.
str_width

Calculate string width in pixels
parse_time_series

Function to transfer data frame with time series values in wide format to format accepted by `line_chart_dense_custom`.
bar_chart_grouped

Generates grouped horizontal barchart with scenario triangles.
column_chart_reference

Generate column chart with reference line.