Relationship between the temperature and positive thoughts

Enter new data:







My hypothesis:

The warmer the weather, the more positive thoughts I have. In addition, the more I sleep, the more positive thoughts I have. And as the time of walking with my dog increases, the number of my positive thoughts increases. Also if I have coffee, my positive thoughts increase.

Development process:

In this visualization, I explored multiple elements that could have an impact on my positive thoughts. I set “the average temperature” as my x-axis because I think it could make the biggest impact on my positive thoughts. I used d3.min and d3.max to set the min and max value of x-axis and y-axis, so I don’t need to reset the value manually. I also use d3.scalePow().exponent(2) to display my x-axis because the temperature in the most days is kind of high. So we can see the data more clearly by using this means. Secondly, I used d3.scaleSqrt() to scale the circle in order to reflect the length of sleeping time. It’s easier to see the relationship between sleeping hour and positive thoughts with the changing size of these circles. And because of overlapping data, I used dataset.sort(function) to make sure the small data is in front of the big data. And I set the opacity to 50% ,so we can tell if there is any data overlap or not. In the next step, I use “If” function to color the 3 different lengths of time about taking my dog for a walk. I used gradient color from yellow (shorter time), red to purple (longer time) in order to see if going outside and breathing the fresh air with my dog can increase my positive thoughts or not. Finally, I use selectAll(“text.label”) to put the label of having coffee or not under each data.