hrbrmstr / streamgraph

:wavy_dash: htmlwidget for creating streamgraph visualizations in R
http://hrbrmstr.github.io/streamgraph/
Other
148 stars 49 forks source link

Continuous variables on x-axis not supported yet? #11

Closed aliarsalankazmi closed 7 years ago

aliarsalankazmi commented 9 years ago

Hi,

Was just checking some already resolved issues, and one mentioned that the latest package will have support for continuous variables on the x-axis.

I was checking with toy data and unfortunately could not produce a streamgraph with continuous x-axis variables.

library(streamgraph)
library(dplyr)

df1 <- read.table(text = '
Sector  Month   Sales
IT  Jan 20
Health  Jan 30
Govt    Jan 40
Space   Jan 20
Tourism Jan 10
IT  Feb 30
Health  Feb 20
Govt    Feb 400
Space   Feb 700
Tourism Feb 300
IT  Mar 30
Health  Mar 20
Govt    Mar 40
Space   Mar 20
Tourism Mar 300
', header = TRUE)

df1$Month <- factor(df1$Month, levels = c('Jan', 'Feb', 'Mar'), ordered = TRUE)
df1$Sector <- factor(df1$Sector)
df1$monOrder <- as.numeric(df1$Month)

df1 %>% streamgraph('Sector', 'Sales', 'monOrder')
#Error: 'origin' must be supplied

I have streamgraph_0.7 currently loaded.

Kevark commented 7 years ago

Old, but could be useful for others. You have set scale = "continuous"