I teach p5js to undergraduates as part of a Screen-Based Interaction Design course. It’s great until we get to intermediate data visualization. Importing json and drawing circles is fine, but what everyone wants to do, especially with the elections in 2020, is fill in maps with real time data (think coloring states red and blue from https://commons.wikimedia.org/wiki/File:Blank_US_Map_(states_only).svg).
This is easy in java/processing with loadShape etc, but p5js doesn't seem suited until someone does the heavy lifting needed to make svg native.
So what would you all recommend? I could go with shifting to D3, which would give the students experience with a widely used library. Or there are more specific ones like two.js, paper.js. and rune.js. It looks like bonsai.js and snap.svg are no longer in development.
Which would be an easier shift for students who only have experience with p5js and a little bit of tweaking someone else's jQuery? Which are more reliable for my red state, blue state example across browsers? And will p5js ever make this native?
In addition to p5.js-svg being on github, it has a documentation site, and is on npm, and available via CDN. It hasn’t been in active development for 3-4 years, but seems reasonably accessible and flexible from a teaching perspective – if it meets your need.
What I like about D3 is that there are numerous examples linking data to a US map and the library, it’s built to allow interactions with the data and it is used by places like the NYTimes for very complex graphs (like Obama’s Budget visualization). Seeing how data animates as you change from All spending to Types of spending is very informative.
It’s an advanced library and quickly introduces some of the complex topics like joining data. If the students are going into advanced data visualizations, it’s probably the best to learn. If they are more at an introduction to coding level, I would suggest either using Processing or have them figure out simpler (not map-based) visualizations using standard charts and graphs.