Skip to content

Instantly share code, notes, and snippets.

@SergeStinckwich
Created March 13, 2015 08:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SergeStinckwich/24c5ba61d8cd5915cc17 to your computer and use it in GitHub Desktop.
Save SergeStinckwich/24c5ba61d8cd5915cc17 to your computer and use it in GitHub Desktop.
Senegal pop with M/F ratio
|tab ds b lb |
tab := RTTabTable new input: 'http://senegalouvert.org/data/core/Population-Senegal/r/Population%20Senegal.csv' asUrl retrieveContents usingDelimiter: $,.
tab removeFirstRow.
tab convertColumnsAsFloat: #(1 2 3 4).
b := RTGrapher new.
ds := RTDataSet new.
ds interaction popup.
ds points: tab values.
ds dotShape color: (Color blue alpha: 0.3).
ds x: [ :row | (row at: 1) - 1970 ].
ds y: [ :row | row at: 3 ].
ds dotSize: [ :row | (row at: 4) - (row at: 3) ] min: 5 max: 15 using: #yourself.
b add: ds.
b axisX title: 'Year'; labelConvertion: [ :v | (v + 1970) asInteger ].
b axisY title: 'Million People'; labelConvertion: [ :v | (v / 1000000) round: 2 ].
b build.
lb := RTLegendBuilder new.
lb view: b view.
lb addText: 'Population in Senegal'.
lb build.
b view.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment