diff --git a/1_Data_and_Aesthetic/Assignments/RosalieYu/.DS_Store b/1_Data_and_Aesthetic/Assignments/RosalieYu/.DS_Store new file mode 100644 index 0000000..43d0902 Binary files /dev/null and b/1_Data_and_Aesthetic/Assignments/RosalieYu/.DS_Store differ diff --git a/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/blogPost.rtf b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/blogPost.rtf new file mode 100644 index 0000000..bf2fdb6 --- /dev/null +++ b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/blogPost.rtf @@ -0,0 +1,7 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\margl1440\margr1440\vieww10800\viewh8400\viewkind0 +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +{\field{\*\fldinst{HYPERLINK "http://www.rosalieyu.com/50-shades-of-gray-visualization/"}}{\fldrslt +\f0\fs24 \cf0 http://www.rosalieyu.com/50-shades-of-gray-visualization/}}} \ No newline at end of file diff --git a/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/shading.jpg b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/shading.jpg new file mode 100644 index 0000000..b5d0aa8 Binary files /dev/null and b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/shading.jpg differ diff --git a/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/sketchbook.jpg b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/sketchbook.jpg new file mode 100644 index 0000000..1063b43 Binary files /dev/null and b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/sketchbook.jpg differ diff --git a/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/week2/code.pde b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/week2/code.pde new file mode 100644 index 0000000..5f18337 --- /dev/null +++ b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/week2/code.pde @@ -0,0 +1,25 @@ + +int getArticleKeywordCount(String word, String beginDate, String endDate) { + String request = baseURL + "?q=" + word + "&begin_date=" + beginDate + "&end_date=" + endDate + "&api-key=" + apiKey; + // + int total = 0; + + JSONObject nytData = loadJSONObject(request); + println (request); + // println (nytData); + + // exit(); + JSONObject results = nytData.getJSONObject("response"); + JSONObject results2 = results.getJSONObject("meta"); + + total = results2.getInt("hits"); + println ("There were " + total + " occurences of the term " + word + " between " + beginDate + " and " + endDate); + try { + // nothing + } + catch (Exception e) { + println ("There was an error parsing the JSONObject."); + } + + return(total); +} diff --git a/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/week2/sketch.properties b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/week2/sketch.properties new file mode 100644 index 0000000..8630fa2 --- /dev/null +++ b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/week2/sketch.properties @@ -0,0 +1,2 @@ +mode.id=processing.mode.java.JavaMode +mode=Java diff --git a/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/week2/week2.pde b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/week2/week2.pde new file mode 100644 index 0000000..ca6000d --- /dev/null +++ b/1_Data_and_Aesthetic/Assignments/RosalieYu/50 Shades of Gray/week2/week2.pde @@ -0,0 +1,50 @@ +String apiKey = "cca969849fecc48bed9fa47cda530450:17:69780977"; + +String baseURL = "http://api.nytimes.com/svc/search/v2/articlesearch.json"; + +void setup() { + + size(700, 300); + + String[] words = { + "grey" + }; + // color[] colors = { + // #FF0000, #00FF00, #0000FF + //}; + String[] start = { + + "19650301", "19660301", "19670301", "19680301", "19690301", "19700301", "19710301", "19720301", "19740301", "19750301", "19760301" + }; + String[] end = { + + "20060228", "20070228", "20080228", "20090228", "20100228", "20110228", "20120228", "20130228", "20140228","20150228" + }; + + int barSize = 20; + int startY = 50; + + + /* Search for the words in the given time framed array and stores their values */ + + for (int i = 0; i < start.length; i++) { + int freq = getArticleKeywordCount( words[0], start[i], end[i]); + //int freq1 = getArticleKeywordCount( words[1], start[i], end[i]); + + fill(255); + rect(0, startY + (barSize * i), freq, barSize); + //rect(200, startY + (barSize * i), freq1, barSize); + + fill(100); + text (start[i], 10, startY + (barSize * i) +14 ); + text (start[i], 100, startY + (barSize * i) +14 ); + } +} + +void draw() { + // + noLoop(); +} + +// + diff --git a/1_Data_and_Aesthetic/Assignments/RosalieYu/sunflower_1/.DS_Store b/1_Data_and_Aesthetic/Assignments/RosalieYu/sunflower_1/.DS_Store new file mode 100644 index 0000000..aed6473 Binary files /dev/null and b/1_Data_and_Aesthetic/Assignments/RosalieYu/sunflower_1/.DS_Store differ