Electricity (Part 3: Data Visualization)
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
One way to get a good "feel" for the data before performing deeper analysis is to visualize it. Once the data is in a convenient CSV format, it is often easier to use programs like Excel or Tableau (note that MIT provides free student licenses to these and many other pieces of software) to generate graphs instead of Python. However, the format of spreadsheet data can sometimes make generating certain kinds of graphs difficult, or you may want to polish a certain figure for a paper, so it is good to know how to generate graphs using Python as well.
To practice making graphs in Python, generate the following three plots:
- Make a plot showing each day's measured average temperature over time. (Axes: x-axis: each unique year/month/day in increasing order, y-axis: daily average temperature)
- On one set of axes, plot one line for each year's electricity usage (by month). This graph will give a sense of year-to-year changes in electricity usage. Use a loop to make this plot, rather than explicitly making a separate call to
plt.plot
for each year. (Axes: month, usage) - Make a scatter plot showing each month's electricity usage vs. average temperature. (Axes: x-axis: average monthly temperature (in Fahrenheit), y-axis: electricity usage (in kWh))
Each of these graphs should contain a relevant title, axis labels, and, where appropriate, a legend.
Note that you may find it useful to reference or use the suggested template in the provided graph.py
file from the previous assignment
and the examples of generating graphs in the relevant readings.
Save the three plots (as PNG or SVG images), and all of the code you used to generate them in a single python file (or Jupyter notebook). Combine these four files into a zip file, and upload that file below.
Rubric: 5 pts: Code used to generate graphs is present, correct, and has good style.
5 pts for each of the three graphs (15 points total):
Next Exercise: Survey