Archive for the ‘Processing’ Category

Visualizing networks by hierarchical-edge-bundling using Processing

Thursday, December 27th, 2012

String lines[] = loadStrings(“D:/shortPaths.csv”);
float [][] csv;
int csvWidth=10;

csv = new float [lines.length][csvWidth];

//parse values into 2d array
for (int i=1; i < lines.length; i++) {
String [] temp = new String [lines.length];
temp= split(lines[i], ‘,’);
for (int j=0; j < temp.length; j++){
csv[i][j]= (float (temp[j]) +500)/2;
}
}

noFill();
size (650,500);
background(0);

for (int i=1; i<lines.length; i++){
int x=0;
stroke((csv[i][8]*2-500) * 3 *20 % 255,(csv[i][8]*2-500) * 5 *20 % 255,(csv[i][8]*2-500) * 7 *20 % 255,20);
pushMatrix();
translate(630, 0);
rotate(radians(90));
bezier(csv[i][0],csv[i][1],csv[i][2],csv[i][3],csv[i][4],csv[i][5],csv[i][6],csv[i][7]);
popMatrix();
}

String ls [] = {“Chinese”,”English”,”German”,”French”, “Japanese”, “Korean”,”Spanish”,”Portuguese”,”Italian”,”Polish”,
“Vietnamese”,”Arabic”,”Turkish”,”Russian”,”Dutch”,”Thai”,”Czech”};
for (int i=1;i<=17;i++){
stroke(i * 3 *20 % 255,i * 5 *20 % 255,i * 7 *20 % 255);
fill(i * 3 *20 % 255,i * 5 *20 % 255,i * 7 *20 % 255);
ellipse(25,65+20*i,10,10);
textSize(15);
text(ls[i-1],45, 70+ 20 *i);
}

//save(“D:/HEB_continuous.png”);