I'm working on a visualization project in R and thought of creating bar charts for hierarchical data (states with constituencies in it, each constituency possessing a numeric value).
I came across this web page ( https://observablehq.com/@d3/hierarchical-bar-chart ) which implements exactly this using library "d3" but for JavaScript.
Is there any similar library in R to do this?
I also had similar question before! But I couldn't find any package or code online that does the same thing in R, the closest thing I found was "r2d3" package which allows you to run javascript in R.
So by leveraging the "r2d3" package, I was able to replicate it and put it into a function call "hbar", you can directly source it from my github with the code below: source("https://raw.githubusercontent.com/JohnnyPeng123/hierarchical_bar_chart-/master/hbar.r")
For more details and use case please follow the link below: https://github.com/JohnnyPeng123/hierarchical_bar_chart-
Let me know if you need any help in terms of using this function.
You can use ggplot.
If you need more help, please share a reproductive example.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.