Data Analysis for Engineers/Module 4

Module 4 · Section 10 of 10

Mini-Project 4: Multi-Panel Facility Energy Report Figure

Objective: Create a single publication-ready 3-panel figure for one site: (1) monthly energy bar chart, (2) monthly average temperature trend line, (3) a weekday-vs-weekend mean-energy comparison. Export as PNG and PDF.

Brief

Using the df dataset built at the top of this notebook, produce a 3-panel figure for "Charlie DC" covering 2023:

  1. A bar chart of total monthly energy
  2. A line chart of monthly average ambient temperature
  3. A small bar chart comparing mean daily energy on weekdays vs weekends

Export the final figure as both PNG and PDF.

Starter Code

# One site; add helper columns for the three panels
site = df[df["site"] == "Charlie DC"].copy()
site["month"] = site["date"].dt.month
site["is_weekend"] = site["date"].dt.weekday >= 5     # Sat=5, Sun=6 -> True

monthly_energy = site.groupby("month")["energy_kwh"].sum()
monthly_temp = site.groupby("month")["ambient_c"].mean()
by_daytype = site.groupby("is_weekend")["energy_kwh"].mean()   # index: False, True

# One Figure, three stacked Axes (3 rows x 1 col)
fig, axes = plt.subplots(3, 1, figsize=(9, 9))

axes[0].bar(monthly_energy.index, monthly_energy.values, color="steelblue")
axes[0].set_title("(1) Monthly Total Energy - Charlie DC, 2023")
axes[0].set_ylabel("Energy (kWh)"); axes[0].set_xticks(range(1, 13))

axes[1].plot(monthly_temp.index, monthly_temp.values, marker="o", color="firebrick")
axes[1].set_title("(2) Monthly Average Ambient Temperature")
axes[1].set_ylabel("Temp (C)"); axes[1].set_xticks(range(1, 13))

axes[2].bar(["Weekday", "Weekend"], by_daytype.values, color=["teal", "sandybrown"])
axes[2].set_title("(3) Mean Daily Energy: Weekday vs Weekend")
axes[2].set_ylabel("Mean Energy (kWh)")

plt.tight_layout(); plt.show()

# Export the whole 3-panel figure for a report
fig.savefig("m4_miniproject_report.png", dpi=150, bbox_inches="tight")
fig.savefig("m4_miniproject_report.pdf", bbox_inches="tight")
print("Saved m4_miniproject_report.png and .pdf")

Deliverable Checklist

  • All 3 panels render correctly with readable axes and labels
  • Panel titles clearly numbered/labeled matching the brief
  • Colors chosen sensibly (not an arbitrary palette)
  • Figure exported as both PNG (150+ dpi) and PDF
  • A short caption (2-3 sentences) suitable for a report, describing what the figure shows

Grading Rubric

CriterionPoints
All 3 panels correctly built45
Layout, labels, and titles clear and professional25
Correct PNG + PDF export15
Written caption15
Total100
# Your Mini-Project 4 submission

43 / 63 sections · Course home · Join the coaching cohort