ElectionVR is an experiment in using virtual reality to give people a more intuitive and nuanced view of election data. It allows you to walk around a map of the United States and explore the data for the last four presidential elections, showing the number and percentage of votes that each of the major candidates received in each state. You’ll be able to see that in 2016 more 1 million people in the democratic stronghold of Massachusetts voted for Donald Trump and that almost 4 million people in Texas voted for Hillary Clinton, a state which no Democrat has won since 1976. You’ll also see the surprisingly strong showing of third-party candidates, such as Gary Johnson and Evan McMullin, especially as compared to previous elections.
To explore these stories and more, go to: https://sbrudz.github.io/election-vr/
The visualization is built in WebVR so it can be viewed using the HTC Vive, Oculus Rift, Google Cardboard, or a Desktop browser. The Vive and the Rift support controller-based interactions to move and scale the map.
The data
subdirectory contains the source data files used in the visualization.
The election data were downloaded from the Federal Election Commission website
and processed using the data/build-election-data-files.sh
script.
The map data were downloaded from census.gov and processed using the data/build-map-files.sh
script.
The FIPS code to state data is also from census.gov: http://www2.census.gov/geo/docs/reference/state.txt
These scripts provide a reproducible way to download and process the data files into the versions in src/assets
that are used
directly in the visualization. Note that the scripts must be run from within the data
subdirectory. They also
require several globally installed npm packages. See the header of each file for details.
Finally, per the instructions on census.gov, I must state that "This product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau."
When making changes to this project, it's easiest to run it locally using the webpack dev server:
npm install
npm start
The local version can then be accessed at http://localhost:3000
This project uses github actions to automatically build and deploy the latest commit on the main
branch to GitHub pages.
The URL is: https://sbrudz.github.io/election-vr/
To test out the production build locally:
npm run prod
and access it at: http://localhost:4000
- To John Samuelson, Adam Simcock, Don Smith, Jared Chapiewsky, AJ Wortley, Linda Brudz, and Jake Brudz for their feedback, testing, and support
- To Kevin Ngo, Diego Marcos, Don McCurdy and many others at Mozilla and the community for creating the A-Frame WebVR framework
- To Matthias Treitler for his aframe-geojson-component which provided inspiration and a starting point for how to display maps in VR
- To Will Murphy for his super hands component which provides progressive support and gestures for different types of controllers
- To Mike Bostock for creating d3.js and for his excellent series of articles on command line cartography
Created by Steve Brudz.
Initial version sponsored by Earthling Interactive.
Current work sponsored by Def Method.
- Test on Oculus Go
- Add visualization of voter turnout data
- Switch to voter density for sizing of shapes
- Add number of electoral college votes received per candidate