Last active
September 19, 2018 03:13
-
-
Save timturnidge/165b339e2a7b0f6a157180d7778ff3b8 to your computer and use it in GitHub Desktop.
Reading .csv in Processing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// power data from https://docs.google.com/spreadsheets/d/1OJRMHsO8UV397Bh1dv2ADx8TBEV7WKa_D-TKlPJidTs/edit#gid=0 | |
Table data; | |
void setup() { | |
size(400, 300); | |
data = loadTable("data/energy.csv", "header"); | |
println(data.getRow(0).getFloat(2)); | |
} | |
void draw() { | |
background(255); | |
noStroke(); | |
for (int i = 0; i < 52; i++) { | |
fill(0, data.getRow(i).getFloat(2)*10); | |
rect(i*5, 0, 5, data.getRow(i).getFloat(2)*5); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment