Below is a subset of the data I have.
Abby John Mike Date
4.0 6 3 03-30
3.2 5 1 03-31
4.0 6 3 04-01
4.1 8 2 04-02
6.0 6 1 04-03
Am trying to plot a stacked/grouped bar chart with date on the x axis and all the users data on the Y (for a particular date 3 grouped bars on the Y axis indicating Abby, John and Mike's data). I tried using the Rcharts library example at: http://ramnathv.github.io/posts/rcharts-nvd3/index.html
But unlike the one used there, my data is continuous and not a factor. Is there anyway I can do this using ggvis or rCharts? I have only used these 2 plotting libraries as yet.
Appreciate any help or guidance. Thanks.
You can use Highcharts
in RCharts
to do what you want. Note that you would probably need to manipulate the data a bit...
rm(list = ls())
library(rCharts)
# Prepare data
x <- data.frame(USPersonalExpenditure)
colnames(x) <- substr(colnames(x), 2, 5)
Names <- rownames(x)
Dates <- colnames(x)
colnames(x) <- Names
rownames(x) <- Dates
# Create chart
a <- rCharts:::Highcharts$new()
a$chart(type = "column")
a$title(text = "US Personal Expenditure")
a$xAxis(categories = rownames(x))
a$plotOptions(column = list(stacking = "normal"))
a$yAxis(title = list(text = "Billions of dollars"))
a$data(x)
a