bar_chart_normalized {tidycharts} | R Documentation |
Generates normalized horizontal barchart. If more than one series is supplied, stacked barchart is generated.
Description
Generates normalized horizontal barchart. If more than one series is supplied, stacked barchart is generated.
Usage
bar_chart_normalized(data, cat, series, series_labels = series)
Arguments
data |
data frame containing data to be plotted |
cat |
vector containing category names of values |
series |
vector containing names of columns in data with values to plot |
series_labels |
vector containing names of series to be shown on the plot |
Value
object of class tidychart with a character vector containing SVG elements
Examples
#prepare the data frame
data <- data.frame(
city = c("Berlin", "Munich", "Cologne", "London", "Vienna", "Paris", "Zurich"),
Products = c(538, 250, 75, 301, 227, 100, 40),
Services = c(621, 545, 302, 44, 39, 20, 34)
)
#create svg string
barchart_normalized <- bar_chart_normalized(
data = data,
cat = data$city,
series = c("Products", "Services"))
#show the plot
barchart_normalized
[Package tidycharts version 0.1.3 Index]