Customizing Figure Size and Layout
It's **Day 133**, and we're taking control. By default, Matplotlib charts are a bit small and squashed.
Setting the Size
You must set the size **before** you plot anything.
# Width: 12 inches, Height: 6 inches
plt.figure(figsize=(12, 6))
plt.plot(x, y)
plt.show()
Subplots: Multiple Charts in One Row
If you want to show a Line Chart next to a Bar Chart:
# 1 row, 2 columns
fig, ax = plt.subplots(1, 2, figsize=(15, 5))
# Plot on the first one
ax[0].plot(x, y)
ax[0].set_title("Trend")
# Plot on the second one
ax[1].bar(cats, vals)
ax[1].set_title("Categories")
plt.show()
Why this is professional
When شما are presenting in a meeting, tiny fonts and small charts are the easiest way to lose your audience. A large, well-proportioned figure is a hallmark of a senior analyst.
Your Task for Today
Create a figure that contains two charts side-by-side using `plt.subplots`.
*Day 134: Box Plots: Identifying Outliers.*