Electricity (Part 3: Data Visualization)

The questions below are due on Sunday July 20, 2025; 10:00:00 PM.
 
You are not logged in.

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:

  1. 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)
  2. 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)
  3. 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.

.zip file containing three plots and your Python script :

Rubric:
5 pts for each of the three graphs (15 points total):

  • 3 pts - correct figure
  • 1 pt - clearly labeled axes and legend (if needed)
  • 1 pt - title

5 pts: Code used to generate graphs is present, correct, and has good style.

 No file selected

Are these graphs useful? Why or why not?

Formatting Help

Do you notice any surprising trends in the graphs? What might be causing them?

Formatting Help

What other graphs or trend analysis would you perform?

Formatting Help

Next Exercise: Survey

Back to exercises