Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
year,red,orange,yellow,green,blue,indigo,violet,people,have
1985,5517,1636,1397,3965,4056,28,120,27890,52832
1986,5686,1570,1494,4103,4148,38,104,29207,54816
1987,5432,1552,1347,3609,4200,37,114,28718,53612
1988,5417,1554,1327,3955,3897,44,100,28915,53441
1989,5339,1566,1418,4133,3916,55,81,28478,52059
1990,5515,1586,1497,3623,3764,59,98,27838,50740
1991,5146,1449,1436,3513,3746,49,85,26711,48286
1992,5374,1563,1275,3667,4157,37,78,27211,48299
1993,5100,1354,1271,3818,4191,38,82,26525,46442
1994,4986,1527,1362,3869,3815,49,78,26606,45522
1995,5421,1755,1350,3792,3957,39,82,26726,46715
1996,5707,1699,1523,4398,4189,41,105,28882,48534
1997,5764,1702,1566,4452,4412,47,138,28074,49700
1998,6381,1912,1840,4871,4925,57,139,29463,53821
1999,6462,1993,1844,4926,5020,56,125,31279,55284
2000,6626,2066,1756,5369,5373,75,152,33068,57267
2001,7048,1937,1802,5300,5380,56,127,33384,57186
2002,7224,1943,1871,5255,5274,64,128,34133,59355
2003,7283,2180,1878,4982,5015,40,117,33867,58484
2004,7775,2079,1862,5041,5183,57,141,32620,56417
2005,7573,2211,1729,5009,4955,60,121,32740,56741
2006,9396,2672,2328,6853,6196,65,159,39715,73070
2007,9823,2707,2295,7567,6241,112,153,44256,82084
2008,10784,2603,2191,8662,7193,87,194,45394,85546
2009,10887,3168,2288,9854,6879,82,199,48257,92154
2010,10645,2896,2422,9256,6840,93,185,46911,89632
2011,10476,2568,2217,8965,6704,110,294,46641,84759
2012,10522,2325,2258,7991,6609,83,181,44947,81820
2013,8825,2109,2058,5850,5637,92,201,38963,68268
2014,16249,3900,3629,10678,10064,133,324,93552,180470
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
year,red,orange,yellow,green,blue,indigo,violet,people,have
1965,5656,1703,1021,4208,3167,21,168,13614,49491
1966,6672,2247,1302,5592,4016,23,214,16004,52037
1967,7129,2132,1330,5308,3911,21,207,15552,49538
1968,5745,1795,1118,3768,3453,18,150,17061,49760
1969,5303,1555,1147,3684,3334,23,157,16445,48184
1970,6036,1851,1282,4816,3932,22,131,17049,46140
1971,5031,1527,992,3552,3283,11,138,17794,46859
1972,5570,1968,1115,3760,3687,17,105,19698,50155
1973,6748,2107,1263,5451,4438,24,148,21786,52570
1974,6684,2061,1277,5081,4237,28,112,21549,52583
1975,6491,1926,1250,4551,4251,27,129,22253,53190
1976,6693,2001,1341,4617,4661,18,144,23398,52521
1977,6766,2293,1462,5055,4968,33,120,24576,53825
1978,5263,1691,1143,3491,3547,29,146,19082,40902
1979,6256,1973,1566,4597,4260,20,148,23640,50294
1980,9037,2900,2181,6644,6330,28,217,38341,79360
1981,5132,1623,1350,3895,3534,31,109,25787,51861
1982,5049,1553,1166,3602,3510,26,95,25392,51123
1983,4743,1603,1133,3535,3435,22,78,25555,49642
1984,4808,1687,1195,3698,3604,34,81,27099,51669
1985,5517,1636,1397,3965,4056,28,120,27890,52832
1986,5686,1570,1494,4103,4148,38,104,29207,54816
1987,5432,1552,1347,3609,4200,37,114,28718,53612
1988,5417,1554,1327,3955,3897,44,100,28915,53441
1989,5339,1566,1418,4133,3916,55,81,28478,52059
1990,5515,1586,1497,3623,3764,59,98,27838,50740
1991,5146,1449,1436,3513,3746,49,85,26711,48286
1992,5374,1563,1275,3667,4157,37,78,27211,48299
1993,5100,1354,1271,3818,4191,38,82,26525,46442
1994,4986,1527,1362,3869,3815,49,78,26606,45522
1995,5421,1755,1350,3792,3957,39,82,26726,46715
1996,5707,1699,1523,4398,4189,41,105,28882,48534
1997,5764,1702,1566,4452,4412,47,138,28074,49700
1998,6381,1912,1840,4871,4925,57,139,29463,53821
1999,6462,1993,1844,4926,5020,56,125,31279,55284
2000,6626,2066,1756,5369,5373,75,152,33068,57267
2001,7048,1937,1802,5300,5380,56,127,33384,57186
2002,7224,1943,1871,5255,5274,64,128,34133,59355
2003,7283,2180,1878,4982,5015,40,117,33867,58484
2004,7775,2079,1862,5041,5183,57,141,32620,56417
2005,7573,2211,1729,5009,4955,60,121,32740,56741
2006,9396,2672,2328,6853,6196,65,159,39715,73070
2007,9823,2707,2295,7567,6241,112,153,44256,82084
2008,10784,2603,2191,8662,7193,87,194,45394,85546
2009,10887,3168,2288,9854,6879,82,199,48257,92154
2010,10645,2896,2422,9256,6840,93,185,46911,89632
2011,10476,2568,2217,8965,6704,110,294,46641,84759
2012,10522,2325,2258,7991,6609,83,181,44947,81820
2013,8825,2109,2058,5850,5637,92,201,38963,68268
2014,16249,3900,3629,10678,10064,133,324,93552,180470
230 changes: 230 additions & 0 deletions 1_Data_and_Aesthetic/Assignments/johnChoi/rainbow02/rainbow02.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
Table myTable;
PFont font;
PFont font14;

float[] year = new float[30];
float[] red = new float[30];
float[] orange = new float[30];
float[] yellow = new float[30];
float[] green = new float[30];
float[] blue = new float[30];
float[] indigo = new float[30];
float[] violet = new float[30];
float[] people = new float[30];
float[] have = new float[30];

float redMax;
float orangeMax;
float yellowMax;
float greenMax;
float blueMax;
float indigoMax;
float violetMax;

void setup() {
size (1280, 720, P3D);
smooth(4);

myTable = loadTable("rainbow.csv", "header");

for (int i =0; i<myTable.getRowCount (); i++) {
TableRow row = myTable.getRow(i);

people[i] = row.getInt("people")/50;
have[i] = row.getInt("have")/50;
float normalization = (people[i]+have[i]);

year[i] = row.getInt("year");
red[i] = row.getInt("red") / normalization;
orange[i] = row.getInt("orange")/ normalization;
yellow[i] = row.getInt("yellow")/ normalization;
green[i] = row.getInt("green") / normalization;
blue[i] = row.getInt("blue") / normalization;
indigo[i] = row.getInt("indigo")/ normalization;
violet[i] = row.getInt("violet")/ normalization;
}

redMax = max(red);
orangeMax = max(orange);
yellowMax = max(yellow);
greenMax = max(green);
blueMax = max(blue);
indigoMax = max(indigo);
violetMax = max(violet);

font = loadFont("HelveticaNeue-Bold-72.vlw");
font14 = loadFont("HelveticaNeue-Bold-14.vlw");
}

void draw() {
background(189, 189, 181);


textAlign(CENTER);

float w = 5;
int alpha =180;

noStroke();

for (int i =0; i<myTable.getRowCount (); i++) {

float x = map(i, 0, myTable.getRowCount(), 50, width-20);

// red bar
fill(255, 0, 0, alpha);
bargraph(x, w, red[i], redMax);

// orange bar
pushMatrix();
translate(w-1, 0);
fill(255, 127, 0, alpha);
bargraph(x, w, orange[i], orangeMax);
popMatrix();

//yellow bar
pushMatrix();
translate(w*2-2, 0);
fill(255, 255, 0, alpha);
bargraph(x, w, yellow[i], yellowMax);
popMatrix();

//green bar
pushMatrix();
translate(w*3-3, 0);
fill(0, 255, 0, alpha);
bargraph(x, w, green[i], greenMax);
// year text
textFont(font14, 14);
fill(0, 100);
text(str((int)year[i]), x+2, height-35+1);
fill(255);
text(str((int)year[i]), x+1, height-35);
popMatrix();

//blue bar
pushMatrix();
translate(w*4-4, 0);
fill(0, 0, 255, alpha);
bargraph(x, w, blue[i], blueMax);
popMatrix();

//indigo bar
pushMatrix();
translate(w*5-5, 0);
fill(75, 0, 130, alpha);
bargraph(x, w, indigo[i], indigoMax);
popMatrix();

//violet bar
pushMatrix();
translate(w*6-6, 0);
fill(127, 0, 255, alpha);
bargraph(x, w, violet[i], violetMax);
popMatrix();
}


/////////////lines//////////////////////////
noFill();

// red line
stroke(255, 0, 0);
beginShape();
for (int i =0; i<myTable.getRowCount (); i++) {
float x = map(i, 0, myTable.getRowCount(), 50, width-20);
float H = map(red[i], 0, redMax, 0, height-111);
float Y = height-50-H;
vertex(x, Y);
}
endShape();

// orange line
stroke(255, 127, 0);
beginShape();
for (int i =0; i<myTable.getRowCount (); i++) {
float x = map(i, 0, myTable.getRowCount(), 50, width-20);
float H = map(orange[i], 0, orangeMax, 0, height-111);
float Y = height-50-H;
vertex(x+w-1, Y);
}
endShape();

//yellow line
stroke(255, 255, 0);
beginShape();
for (int i =0; i<myTable.getRowCount (); i++) {
float x = map(i, 0, myTable.getRowCount(), 50, width-20);
float H = map(yellow[i], 0, yellowMax, 0, height-111);
float Y = height-50-H;
vertex(x+w*2-2, Y);
}
endShape();

//green line
stroke(0, 255, 0);
beginShape();
for (int i =0; i<myTable.getRowCount (); i++) {
float x = map(i, 0, myTable.getRowCount(), 50, width-20);
float H = map(green[i], 0, greenMax, 0, height-111);
float Y = height-50-H;
vertex(x+w*3-3, Y);
}
endShape();

//blue line
stroke(0, 0, 255);
beginShape();
for (int i =0; i<myTable.getRowCount (); i++) {
float x = map(i, 0, myTable.getRowCount(), 50, width-20);
float H = map(blue[i], 0, blueMax, 0, height-111);
float Y = height-50-H;
vertex(x+w*4-4, Y);
}
endShape();

//indigo line
stroke(75, 0, 130);
beginShape();
for (int i =0; i<myTable.getRowCount (); i++) {
float x = map(i, 0, myTable.getRowCount(), 50, width-20);
float H = map(indigo[i], 0, indigoMax, 0, height-111);
float Y = height-50-H;
vertex(x+w*5-5, Y);
}
endShape();

//violet line
stroke(127, 0, 255);
beginShape();
for (int i =0; i<myTable.getRowCount (); i++) {
float x = map(i, 0, myTable.getRowCount(), 50, width-20);
float H = map(violet[i], 0, violetMax, 0, height-111);
float Y = height-50-H;
vertex(x+w*6-6, Y);
}
endShape();


//text
fill(0, 100);
noStroke();
textAlign(CENTER);
textFont(font, 72);
text("RAINBOW hangs in New York Times", width/2+1, height*3/4+1);
fill(255, 200);
text("RAINBOW hangs in New York Times", width/2, height*3/4);


println("done");
noLoop();
}


void bargraph(float _x, float _w, float _h, float _max) {
float H = map(_h, 0, _max, 0, height-111);
float Y = height-50-H;
rect(_x, Y, _w, H);
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mode.id=processing.mode.java.JavaMode
mode=Java
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9,1851,pig53,1852,rat94,1853,cow93,1854,tiger60,1855,rabbit53,1856,dragon109,1857,snake142,1858,horse77,1859,sheep116,1860,monkey44,1861,rooster25,1862,dog24,1863,pig29,1864,rat40,1865,cow47,1866,tiger73,1867,rabbit95,1868,dragon55,1869,snake86,1870,horse77,1871,sheep54,1872,monkey55,1873,rooster69,1874,dog39,1875,pig52,1876,rat46,1877,cow72,1878,tiger103,1879,rabbit104,1880,dragon107,1881,snake123,1882,horse115,1883,sheep98,1884,monkey109,1885,rooster99,1886,dog82,1887,pig85,1888,rat68,1889,cow154,1890,tiger192,1891,rabbit183,1892,dragon171,1893,snake193,1894,horse277,1895,sheep141,1896,monkey204,1897,rooster241,1898,dog222,1899,pig385,1900,rat296,1901,cow279,1902,tiger266,1903,rabbit288,1904,dragon192,1905,snake185,1906,horse180,1907,sheep175,1908,monkey168,1909,rooster194,1910,dog224,1911,pig289,1912,rat258,1913,cow212,1914,tiger238,1915,rabbit191,1916,dragon160,1917,snake101,1918,horse164,1919,sheep186,1920,monkey291,1921,rooster238,1922,dog376,1923,pig441,1924,rat511,1925,cow500,1926,tiger560,1927,rabbit522,1928,dragon447,1929,snake445,1930,horse555,1931,sheep645,1932,monkey465,1933,rooster373,1934,dog435,1935,pig381,1936,rat626,1937,cow633,1938,tiger643,1939,rabbit526,1940,dragon402,1941,snake484,1942,horse411,1943,sheep384,1944,monkey457,1945,rooster473,1946,dog445,1947,pig377,1948,rat486,1949,cow943,1950,tiger977,1951,rabbit782,1952,dragon752,1953,snake656,1954,horse733,1955,sheep571,1956,monkey577,1957,rooster537,1958,dog694,1959,pig640,1960,rat529,1961,cow740,1962,tiger789,1963,rabbit829,1964,dragon763,1965,snake1049,1966,horse942,1967,sheep626,1968,monkey677,1969,rooster766,1970,dog945,1971,pig908,1972,rat1003,1973,cow820,1974,tiger918,1975,rabbit1010,1976,dragon933,1977,snake895,1978,horse1323,1979,sheep1484,1980,monkey781,1981,rooster704,1982,dog622,1983,pig704,1984,rat712,1985,cow711,1986,tiger851,1987,rabbit836,1988,dragon1095,1989,snake983,1990,horse714,1991,sheep682,1992,monkey758,1993,rooster765,1994,dog753,1995,pig925,1996,rat1081,1997,cow1195,1998,tiger1179,1999,rabbit1232,2000,dragon1077,2001,snake938,2002,horse1157,2003,sheep1138,2004,monkey1228,2005,rooster1446,2006,dog1795,2007,pig1875,2008,rat1910,2009,cow2157,2010,tiger2064,2011,rabbit2461,2012,dragon2086,2013,snake4717,2014,horse
Expand Down
Loading