SHORT DESCRIPTION:
Our assignment for the fourth week is data visualization along with typography. The data I chosen for this assignment is taken from the popular database website Kaggle. To visualize the data, I used a collection of different sized circles that was determined by the number of medals each of the 91 countries had won.
INITAL APPOACH
Initially, I had a lot of trouble finding the data that I wanted to use for my assignment because the dataset wasn’t organize, lacked information, or was too complex to be used. In addition, I also didn’t know what I wanted to do, so I felt super unconfident and uncreative in my work. I had an early approach to display the decomposition of RGB values of a randomly chosen color, but the end product left me extremely unexcited and disappointed. Below was my first attempt for the data visualization of color.
First Sketch of Data Visualization: Click the screen to change colors
Through the frustration of this project, I decided to give data searching another chance and decided to use Kaggle since I was a familiar with the site and could filter through different categorizes of datasets. Eventually I ended up finding the Paris Olympic medal dataset and was interested in the breakdown and ranking of the countries that participated.
CODING PROCESS
To not let my RGB project go to waste, I decided to incorporate my main goals and what I learned from the RGB project into the visualization for the distribution of Olympic medals: generating a random color, changing the canvas when the mouse is clicked and having text on screen.
function getRandomColorAndRatio(){ colorRatio = [random(0,255), random(0,255), random(0,255)]; updateCircleColor(); } function updateCircleColor(){ circleColor = color(colorRatio[0], colorRatio[1], colorRatio[2]); } function mousePressed() { getRandomColorAndRatio(); }
Also to note, I decided to remove the draw() function in my code because the name was deceptive to me, and I didn’t need my screen to constant refresh, so it was easier to declare my own function and call them in setup().
THE HARDSHIPS
Honestly, the hardest part this week was overcoming the uncreative block and finding a dataset I was interested to work with. For my code, I didn’t have too much trouble importing the data or implementing my idea because I already had a basis of what I wanted my project to look like and the interactive feature to because of my initial approach. I did have trouble figuring out the math to corelated the sizes of the circles with the number of medals awarded because I dumbly decided to work on the whole dataset instead of the first ten. So my future advice for people, is to work within a small range of your data first before implementing the code across the entire dataset. Otherwise, you’ll find that rank 84 in the world has the biggest circle and rank 1 has the smallest circle because you didn’t check your math.
Math for Circle Sizes
// circles are has a scale factor of 10% based on the ratio of a countries medals awarded with the total medals awarded in relation to the width let size = 10 * (countryTotal/ totalMedalsAwarded); let circleArea = (width) * size
THE UPSIDES
For my final product, I ended up with two concepts of my dataset. The first version is sort of a generative art that will randomly place the circles of the countries’ medal with a random color somewhere on the screen. Though, it sounds chaotic, I feel the circular shapes and (if lucky) the pastel color gives a bubbly and warm feeling to the viewer. It was also here that I noticed my mistake where rank 84 was much larger than the top ten because I had labeled each circle and didn’t see any of the top 10 countries listed. Through in the end, in the code I commented out the countries’ names and rank because I felt it added too much noise and unnecessary complexity into the composition.
Data Visualization 1: Click to change composition
For my second concept, I decided to have a structed data visualization. To do so, I simply implemented a double for-loop to create a 10 by 10 matrix and map each of the circle centers to their respective coordinates. Once the circles were maps, I uncommented the text label for the countries’ rank and medals, and I feel like it tired the project together. However, sometimes the randomization of the colors may cause the label, and sometimes the circle, to blend into the background and making it invisible. I think for future plans, it would be nice to figure out a solution to keep randomization but not have it blend with the background.
For-loop Code and If-Else Statement to check if there are still data to be processed
// organize the datas in a set 10 x 10 coordinate fashion function xyPos(){ for (let yPos = 120; yPos < height; yPos+= 120){ for (let xPos = 120; xPos < width; xPos += 120){ // there will be extra spaces in the end so it is necessary to always check that there are still rows/ data left in the file to be processed if (fileRow < strings.length){ lineFile = split(strings[fileRow], ",") runFile(xPos, yPos, lineFile); fileRow += 1 } } } }
I had to increase the canvas size to 1200 x 1200 in order for the labels to not overlap with each other, so here is the link to project, for anyone wanting to see the code.
Data Visualization 2: Visualizations of the number of medals award to each 91 participating countries
FINAL REMARKS
While time consuming, compared to my first project, I am extremely happy with my final result. I really liked processing the data and understanding which of the data was useful to me and would be the most impactful to the viewer. I had also learned that the Olympics ranks by gold medals, not total medals. I was really confused why Brazil was ranked 8th when it had more medals than those that ranked higher than them. Overall, I had a lot of fun using the data and then seeing the work tied together.
Also, in my code, I have a breakdown of each countries’ medals by gold, silver, and bronze. I didn’t include it in concept 2 photo because I wanted to keep it straightforward and simple.
Breakdown of Countries' Medals
console.log('Team ' + countryCode + ' won ' + countryTotal + ' medals with ' + countryGold +' gold medals, ' + countrySilver + ' silver medals, and ' + countryBronze + ' bronze medals!')
This is nicely done but I think the choice to use completely random colours could be reexamined for a data visualization. Having the colours be somehow related to to the data would be a better choice. If you want to make it interactive consider if there’s a way to give the user an interaction that would allow them to understand the data better – e.g. maybe they could click on a country to highlight that country and see a breakdown of the medals. Or you could have a mix of random and calculated, e.g. going from colour 1 to colour 2 for more medals and clicking randomly changes colour 1 and 2. It’s looking good, with some more development of the look it could be really great!