Tanzania's new constitution, 2015: A data visualization
Summary
23 March 2015. A data visualization, written in d3.js
of how Tanzanians are likely to vote in the upcoming referendum on the new constitution (katiba). This visualization uses data collected from Africa's first nationally-representative mobile phone survey, Sauti za Wananchi ("Voice of the People"). This also will serve as the final project on the Udacity's Data Visualization and D3.js course.
Design
The first design idea: I'll use a force layout of each individual observation (anonymized), with voters moving to the left ("NAY") or right ("YEA") on the hypothetical referendum question.
Chart type: Force layout.
Visual encodings:
Variable | Visual encoding |
---|---|
Observation | Circle, fixed radius |
Vote | x location |
Draft preference | y locationx location |
Rural/Urban | |
Gender | Fill color |
Party | Fill color |
Age | Fill color |
Feedback
The first version of index.html
(and co.) is here.
First reviewer:
- The labels for which draft people would prefer are not correct; the top should be the second draft by the CRC and the final draft by the Constitution Assembly
- I think you should consider dropping urban in the 3 keys. It is easier for the readers to make a comparison between rural and urban or male and female.
- On the tab that provides data on whether people will vote for or vote against the constitution, I think we should all the responses in the final visualization. The group that is sent away helps in telling the story and if anyone would like to change the outcome they are the determinants of whether the constitution referendum will go through or not.
- The results on whether people will vote for or vote against the constitution are in a different language. That said, have you considered have the visualization in Swahili. You will get a larger audience because, Tanzanians are more excited about Kiswahili.
Second reviewer:
I would be interested too in seeing the more substantive questions visualized, eg on what people liked in the previous draft. And a more sensitive issue: what the political affiliation is of the yea/nae sayers ...
Third reviewer:
Include big disclaimer re: no Zanzibar data. Put titles/buttons on top. Make constitution question horizontal, instead of vertical (text boxes always on the bottom). Add age visual encoding (<35 and >=35?). Add unknowns bubble.
Resources
- Resource: Udacity - Data visualization and D3.js
- Resource: d3.js API - Force layout
- Resource: w3schools - SVG
- Q&A: StackOverflow - Force layout within a shape
- Q&A: D3.js GitHub - Speeding up force layouts
- Q&A: StackOverflow - Speeding up a force layout with many nodes
- Q&A: StackOverflow - Controlling the initial animation
- Tutorial: AirPair - Understanding the force layout
TODO
Getgit
set up, etc.Template from previous force layout dataviz.- Add image of design iteration.
- Prep data for
2015, 2014, 2013 (all SZW), and 2012 (Afrobarometer). Incorporate Udacity tips re: accessor and visualization functions (get better at understanding callbacks).Add draft-preference buttons.Style everything.- Fluidify the force layout - right now it lags a lot.
The problem of sample weights...!Add reset button.Add tons of explanatory captions.Add fancy Sam Pepys YEA/NAY tooltips.Add urban/rural, gender highlights + buttons.Are my hard-coded labels right!?(Hard-coding for now... so wrong..?!)d3.sum
and average the percent of people that are in each bucket.Non-italicEssays 1743
font on the YEA/NAY labels.Legend, with circles.Add Easter egg: randomly allocate random greetings in Swahili to some of the survey dots ("Hujambo! Habari za siku!", etc.). MaybesetInterval()
to make them pop up every 5 seconds or so...Correct draft labels.Change rural/urban from stroke to fill color.Add age (<=35, >35), fill color.Political party, fill color.Include big disclaimer re: no Zanzibar data + if things don't add up to 100%.- Put titles/buttons on top.
Make constitution question horizontal, instead of vertical (text boxes always on the bottom).Add unknowns bubble.- Swahili translation!?!
Make hover+ sticky arrowfor legend selection.- Add transition to color transition.
Data clean: add political party, age.Fix legend colors.