// Code based on https://gist.github.com/johncolby/1295842 String[] lines; float[] x, y, z; int scale = 5; int axis = 80; void setup() { size(800, 480, P3D); // Load scatterplot data lines = loadStrings("data/plot-data.csv"); x = new float[lines.length]; y = new float[lines.length]; z = new float[lines.length]; for (int i=1; i < lines.length; i++) { String[] pieces = split(lines[i], ','); x[i] = float(pieces[0]); y[i] = float(pieces[1]); z[i] = float(pieces[2]); } } void draw() { colorMode(RGB, 1); camera(2.2*50*sin(PI*mouseX/width), 2.2*50*cos(PI*mouseX/width), 10, 0, 0, 35, 0, 0, -1); // Make axis //background(1); background(0, 0, 0, 0); noFill(); stroke(1); line(0, 0, 0, 1*axis, 0, 0); line(0, 0, 0, 0, 1*axis, 0); line(0, 0, 0, 0, 0, 1*axis); // Plot points for (int i=1; i < x.length; i++) { pushMatrix(); translate(scale*x[i], scale*y[i], scale*z[i]); fill(1); box(0.10*scale); noFill(); popMatrix(); } }