View source: R/waffle_charts.R
waffle_chart | R Documentation |
The function uses ggplot2 to create waffle charts from data.
waffle_chart( data, fill, value = "value", facet = NULL, composition = TRUE, max_value = NULL, digits = 3, fill_colors = NULL, fill_title = NULL, ncol = NULL, base_size = 12, line_size = LS(1), legend.position = "bottom" )
data |
data frame to be plotted |
fill |
character specifying the column name which should be used as fill for the waffle plot. |
value |
character specifying the column name which contains values of the |
facet |
character specifying the column name which should be used to |
composition |
logical indicating whether a compositional waffle (i.e. fill adds up to 100%) should be created. If |
max_value |
numerical giving the value to which waffle cells should be scaled to, if |
digits |
integer indicating the number of decimal places to be used in rounding of the waffle cells. The value 3 indicates percentages, while 4 permilles. |
fill_colors |
named character vector giving the colors for |
fill_title |
character giving the title for the color legend. |
ncol |
number of columns to be used in facetting. See |
base_size |
numeric giving the base size for the plot. See |
line_size |
numeric value giving the size of lines between waffles cells. |
legend.position |
character specifying the position of the legend. See |
The waffle charts are read from left to right (like text) and from bottom upwards (like water glass). The cells indicate 1% of the maximum value (100
Returns a ggplot2 waffle plot
Mikko Vihtakari with code ideas from hrbrmstr and Liam Gilbey
Other waffle:
round_preserve_sum()
,
waffleize()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.