Module 4 · Section 1 of 10
Module Overview
The charts are built on the multi-site facility energy & environment dataset from
Module 2, with the engineering-specific chart lesson rotating across Electrical,
Mechanical, Chemical, and Industrial practice. Each discipline-leaning example is
tagged inline, e.g. # [Electrical].
Learning Outcomes
- Produce publication-quality charts for engineering reports
- Choose the right chart type for the data and audience
- Build interactive dashboards for presenting findings to clients
Run cells top to bottom. The first code cell sets up inline rendering and rebuilds the synthetic dataset used throughout this module (self-contained - no files needed).
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates # helpers for formatting date axes
plt.rcParams["figure.dpi"] = 100 # default resolution for every figure below
# --- Rebuild a compact synthetic multi-site facility dataset (2023) ---
# (same generator idea as Module 2, plus lat/lon so Lesson 4.7 can map the sites)
np.random.seed(42)
sites = pd.DataFrame({
"site": ["Alpha Plant", "Bravo Fab", "Charlie DC", "Delta Mill", "Echo Lab"],
"sector": ["Chemical", "Semiconductor", "Data Center", "Manufacturing", "R&D"],
"lat": [14.65, 14.51, 15.05, 13.95, 14.28],
"lon": [121.05, 121.02, 120.58, 121.62, 121.41],
})
base_kwh = {"Chemical": 2600, "Semiconductor": 4200, "Data Center": 5200,
"Manufacturing": 3100, "R&D": 900}
dates = pd.date_range("2023-01-01", "2023-12-31", freq="D")
rows = []
for _, s in sites.iterrows():
base = base_kwh[s["sector"]]
for d in dates:
doy = d.dayofyear
cooling = 1.18 if 60 <= doy <= 305 else 1.0 # higher use in warm months
weekday = 1.0 if d.weekday() < 5 else 0.82 # lighter on weekends
energy = round(float(base * cooling * weekday * (1 + np.random.normal(0, 0.06))), 1)
ambient = round(27 + 3 * np.sin((doy - 105) / 365 * 2 * np.pi) + np.random.normal(0, 0.8), 1)
rows.append((s["site"], s["sector"], s["lat"], s["lon"], d, energy, ambient))
df = pd.DataFrame(rows, columns=["site", "sector", "lat", "lon", "date", "energy_kwh", "ambient_c"])
print(df.shape)
df.head()
34 / 63 sections · Course home · Join the coaching cohort