Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(plotly)
- # Create some fake data - say ownership and land use data with acreage
- df <- data.frame(ownership=c(rep("private", 3), rep("public",3),rep("mixed", 3)),
- landuse=c(rep(c("residential", "recreation", "commercial"),3)),
- acres=c(108,143,102, 300,320,500, 37,58,90))
- # Just try some quick pie charts of acreage by landuse and ownership
- plot_ly(data=df, labels= ~landuse, values= ~acres, type='pie')
- plot_ly(data=df, labels= ~ownership, values= ~acres, type='pie')
- # This doesn't render anything... not that I'd expect it to given the data format doesn't seem to match what's needed,
- # but this is what I'd intuitively expect to work..
- plot_ly(data=df, labels= ~landuse, parents = ~ownership, values= ~acres, type='sunburst')
- # Is there an easy way to go from the dataframe, df, to hierarchical format needed for sunburst?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement