BFont f; int[] data; color col; void setup() { size(240,180); f = loadFont("Meta-Bold.vlw.gz"); load(); col = color(255,0,0); } void loop() { background(0); textFont(f,20); text("A graph of data from file: data.csv",10,30); graph(data); } void load() { //load text file as a string String[] stuff = loadStrings("data.csv"); //convert string into an array of integers using ',' as a delimiter data = splitInts(stuff[0],','); } void graph(int[] d) { stroke(col); for (int j = 0; j < d.length-1; j++) { int stretch = 30; line(j*stretch,height-d[j],(j+1)*stretch,height-d[j+1]); } }