Streamgraph package now supports continuous x axis scale
[This article was first published on rud.is » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
A post on StackOverflow asked about using a continuous variable for the x-axis (vs dates) in my streamgraph package. While I provided a workaround for the question, it helped me bump up the priority for adding support for continuous x axis scales. With the DBIR halfway behind me now, I kicked out a new rev of the package/widget that has support for continuous scales.
Using the data from the SO post, you can see there’s not much difference in how you use continuous vs date scales:
library(streamgraph) dat <- read.table(text="week variable value 40 rev1 372.096 40 rev2 506.880 40 rev3 1411.200 40 rev4 198.528 40 rev5 60.800 43 rev1 342.912 43 rev2 501.120 43 rev3 132.352 43 rev4 267.712 43 rev5 82.368 44 rev1 357.504 44 rev2 466.560", header=TRUE) dat %>% streamgraph("variable","value","week", scale="continuous") %>% sg_axis_x(tick_format="d") |
I’ll be adding support for using a categorical variable on the x axis soon. Once that’s done, it’ll be time to do the CRAN dance.
To leave a comment for the author, please follow the link and comment on their blog: rud.is » R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.