BFont f; int COLS = 8; int ROWS = 3; int data[][] = new int[COLS][ROWS]; color[] cols = new color[ROWS]; void setup() { size(240,180); f = loadFont("Meta-Bold.vlw.gz"); load(data); cols[0] = color(255,0,0); cols[1] = color(0,255,0); cols[2] = color(0,0,255); } void loop() { background(0); textFont(f,20); text("A graph of data from file: data.csv",10,30); graph(data); } void load(int[][] d) { String[] stuff = loadStrings("data.csv"); //for every row in the text file //split the string up into integers and //fill 2D array for (int i = 0; i < stuff.length; i++) { int[] row = splitInts(stuff[i],','); for (int j = 0; j < row.length; j++) { d[j][i] = row[j]; } } } void graph(int[][] d) { for (int i = 0; i < ROWS; i++) { stroke(cols[i]); for (int j = 0; j < COLS-1; j++) { int stretch = 30; line(j*stretch,height-d[j][i],(j+1)*stretch,height-d[j+1][i]); } } }