Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions plots/alluvial-basic/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"

# Okabe-Ito palette — use positions 1→N in order
OKABE_ITO = [
IMPRINT = [
"#009E73", # 1: bluish green (brand)
"#D55E00", # 2: vermillion
"#0072B2", # 3: blue
"#CC79A7", # 4: reddish purple
"#C475FD", # 2: vermillion
"#4467A3", # 3: blue
"#BD8233", # 4: reddish purple
]

# Data: Voter migration across 4 election cycles
np.random.seed(42)

time_points = ["2012", "2016", "2020", "2024"]
categories = ["Party A", "Party B", "Party C", "Independent"]
colors = {cat: OKABE_ITO[i] for i, cat in enumerate(categories)}
colors = {cat: IMPRINT[i] for i, cat in enumerate(categories)}

# Node values at each time point (thousands of voters)
node_values = {
Expand Down
6 changes: 3 additions & 3 deletions plots/andrews-curves/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
INK = "#1A1A17" if THEME == "light" else "#F0EFE8"
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"
BRAND = "#009E73"
OKABE_ITO = ["#009E73", "#D55E00", "#0072B2"]
IMPRINT = ["#009E73", "#C475FD", "#4467A3"]

# Data
np.random.seed(42)
Expand Down Expand Up @@ -55,11 +55,11 @@

# Plot Andrews curves for each observation
for i in range(len(curves)):
ax.plot(t, curves[i], color=OKABE_ITO[y[i]], alpha=0.4, linewidth=2.5)
ax.plot(t, curves[i], color=IMPRINT[y[i]], alpha=0.4, linewidth=2.5)

# Create legend with sample lines
for idx, species in enumerate(species_names):
ax.plot([], [], color=OKABE_ITO[idx], linewidth=3, label=species, alpha=0.4)
ax.plot([], [], color=IMPRINT[idx], linewidth=3, label=species, alpha=0.4)

# Style
ax.set_xlabel("t (radians)", fontsize=20, color=INK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
INK_MUTED = "#6B6A63" if THEME == "light" else "#A8A79F"

# Okabe-Ito positions 1-5 (bottom to top: Done → Backlog)
COLORS = ["#009E73", "#D55E00", "#0072B2", "#CC79A7", "#E69F00"]
COLORS = ["#009E73", "#C475FD", "#4467A3", "#BD8233", "#AE3030"]

# Data: 90-day software Kanban board simulation
np.random.seed(42)
Expand Down
42 changes: 21 additions & 21 deletions plots/area-stacked-confidence/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"

# Okabe-Ito palette
OKABE_ITO = ["#009E73", "#D55E00", "#0072B2", "#CC79A7"]
IMPRINT = ["#009E73", "#C475FD", "#4467A3", "#BD8233"]

# Data: quarterly energy consumption by source with measurement uncertainty
np.random.seed(42)
Expand Down Expand Up @@ -73,34 +73,34 @@

# Plot stacked areas from bottom to top with enhanced styling
# Solar (bottom layer)
ax.fill_between(quarters, 0, solar_stack, color=OKABE_ITO[0], alpha=0.85, label="Solar", zorder=3)
ax.fill_between(quarters, solar_lower, solar_upper, color=OKABE_ITO[0], alpha=0.25, linewidth=0, zorder=2)
ax.plot(quarters, solar_lower, color=OKABE_ITO[0], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.plot(quarters, solar_upper, color=OKABE_ITO[0], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.fill_between(quarters, 0, solar_stack, color=IMPRINT[0], alpha=0.85, label="Solar", zorder=3)
ax.fill_between(quarters, solar_lower, solar_upper, color=IMPRINT[0], alpha=0.25, linewidth=0, zorder=2)
ax.plot(quarters, solar_lower, color=IMPRINT[0], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.plot(quarters, solar_upper, color=IMPRINT[0], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)

# Wind (second layer)
ax.fill_between(quarters, solar_stack, wind_stack, color=OKABE_ITO[1], alpha=0.85, label="Wind", zorder=3)
ax.fill_between(quarters, wind_lower, wind_upper, color=OKABE_ITO[1], alpha=0.25, linewidth=0, zorder=2)
ax.plot(quarters, wind_lower, color=OKABE_ITO[1], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.plot(quarters, wind_upper, color=OKABE_ITO[1], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.fill_between(quarters, solar_stack, wind_stack, color=IMPRINT[1], alpha=0.85, label="Wind", zorder=3)
ax.fill_between(quarters, wind_lower, wind_upper, color=IMPRINT[1], alpha=0.25, linewidth=0, zorder=2)
ax.plot(quarters, wind_lower, color=IMPRINT[1], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.plot(quarters, wind_upper, color=IMPRINT[1], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)

# Hydro (third layer)
ax.fill_between(quarters, wind_stack, hydro_stack, color=OKABE_ITO[2], alpha=0.85, label="Hydro", zorder=3)
ax.fill_between(quarters, hydro_lower, hydro_upper, color=OKABE_ITO[2], alpha=0.25, linewidth=0, zorder=2)
ax.plot(quarters, hydro_lower, color=OKABE_ITO[2], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.plot(quarters, hydro_upper, color=OKABE_ITO[2], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.fill_between(quarters, wind_stack, hydro_stack, color=IMPRINT[2], alpha=0.85, label="Hydro", zorder=3)
ax.fill_between(quarters, hydro_lower, hydro_upper, color=IMPRINT[2], alpha=0.25, linewidth=0, zorder=2)
ax.plot(quarters, hydro_lower, color=IMPRINT[2], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.plot(quarters, hydro_upper, color=IMPRINT[2], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)

# Natural Gas (top layer)
ax.fill_between(quarters, hydro_stack, gas_stack, color=OKABE_ITO[3], alpha=0.85, label="Natural Gas", zorder=3)
ax.fill_between(quarters, gas_lower, gas_upper, color=OKABE_ITO[3], alpha=0.25, linewidth=0, zorder=2)
ax.plot(quarters, gas_lower, color=OKABE_ITO[3], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.plot(quarters, gas_upper, color=OKABE_ITO[3], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.fill_between(quarters, hydro_stack, gas_stack, color=IMPRINT[3], alpha=0.85, label="Natural Gas", zorder=3)
ax.fill_between(quarters, gas_lower, gas_upper, color=IMPRINT[3], alpha=0.25, linewidth=0, zorder=2)
ax.plot(quarters, gas_lower, color=IMPRINT[3], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)
ax.plot(quarters, gas_upper, color=IMPRINT[3], linewidth=0.8, alpha=0.4, linestyle=":", zorder=1)

# Add prominent center lines for clarity and visual hierarchy
ax.plot(quarters, solar_stack, color=OKABE_ITO[0], linewidth=3, alpha=1.0, zorder=4, solid_capstyle="round")
ax.plot(quarters, wind_stack, color=OKABE_ITO[1], linewidth=3, alpha=1.0, zorder=4, solid_capstyle="round")
ax.plot(quarters, hydro_stack, color=OKABE_ITO[2], linewidth=3, alpha=1.0, zorder=4, solid_capstyle="round")
ax.plot(quarters, gas_stack, color=OKABE_ITO[3], linewidth=3, alpha=1.0, zorder=4, solid_capstyle="round")
ax.plot(quarters, solar_stack, color=IMPRINT[0], linewidth=3, alpha=1.0, zorder=4, solid_capstyle="round")
ax.plot(quarters, wind_stack, color=IMPRINT[1], linewidth=3, alpha=1.0, zorder=4, solid_capstyle="round")
ax.plot(quarters, hydro_stack, color=IMPRINT[2], linewidth=3, alpha=1.0, zorder=4, solid_capstyle="round")
ax.plot(quarters, gas_stack, color=IMPRINT[3], linewidth=3, alpha=1.0, zorder=4, solid_capstyle="round")

# Styling
ax.set_xlabel("Quarter", fontsize=20, color=INK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"

# Okabe-Ito palette
OKABE_ITO = ["#009E73", "#D55E00", "#0072B2", "#CC79A7", "#E69F00"]
IMPRINT = ["#009E73", "#C475FD", "#4467A3", "#BD8233", "#AE3030"]

# Data - Renewable energy evolution (2014-2024)
years = np.arange(2014, 2025)
Expand All @@ -41,7 +41,7 @@
labels = ["Solar", "Wind", "Hydro", "Natural Gas", "Coal"]

# Create stacked area
ax.stackplot(years, data_percent, labels=labels, colors=OKABE_ITO, alpha=0.85, edgecolor=PAGE_BG, linewidth=1.5)
ax.stackplot(years, data_percent, labels=labels, colors=IMPRINT, alpha=0.85, edgecolor=PAGE_BG, linewidth=1.5)

# Styling
ax.set_xlabel("Year (2014–2024)", fontsize=20, color=INK)
Expand Down
4 changes: 2 additions & 2 deletions plots/area-stacked/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"

# Okabe-Ito palette (use positions 1→N)
OKABE_ITO = ["#009E73", "#D55E00", "#0072B2", "#CC79A7"]
IMPRINT = ["#009E73", "#C475FD", "#4467A3", "#BD8233"]

# Data: Monthly website traffic sources over 24 months
np.random.seed(42)
Expand All @@ -44,7 +44,7 @@
fig, ax = plt.subplots(figsize=(16, 9), facecolor=PAGE_BG)
ax.set_facecolor(PAGE_BG)

ax.stackplot(months, data, labels=categories, colors=OKABE_ITO, alpha=0.85)
ax.stackplot(months, data, labels=categories, colors=IMPRINT, alpha=0.85)

# X-axis formatting (show as months)
tick_positions = [1, 6, 12, 18, 24]
Expand Down
6 changes: 3 additions & 3 deletions plots/bar-diverging/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
values_sorted = values[sorted_indices]

# Create colors using Okabe-Ito palette
# #009E73 (position 1) for positive, #D55E00 (position 2) for negative
colors = ["#009E73" if v >= 0 else "#D55E00" for v in values_sorted]
# #009E73 (position 1) for positive, #C475FD (position 2) for negative
colors = ["#009E73" if v >= 0 else "#C475FD" for v in values_sorted]

# Plot
fig, ax = plt.subplots(figsize=(16, 9), facecolor=PAGE_BG)
Expand Down Expand Up @@ -87,7 +87,7 @@
# Add legend
legend_elements = [
Patch(facecolor="#009E73", edgecolor=INK_SOFT, label="Positive (Satisfied)"),
Patch(facecolor="#D55E00", edgecolor=INK_SOFT, label="Negative (Dissatisfied)"),
Patch(facecolor="#C475FD", edgecolor=INK_SOFT, label="Negative (Dissatisfied)"),
]
leg = ax.legend(handles=legend_elements, loc="lower right", fontsize=16)
if leg:
Expand Down
4 changes: 2 additions & 2 deletions plots/bar-grouped/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
INK_MUTED = "#6B6A63" if THEME == "light" else "#A8A79F"

# Okabe-Ito palette (position 1 is always #009E73)
OKABE_ITO = ["#009E73", "#D55E00", "#0072B2"]
IMPRINT = ["#009E73", "#C475FD", "#4467A3"]

# Data: Quarterly sales by product line (in thousands USD)
categories = ["Q1", "Q2", "Q3", "Q4"]
Expand All @@ -45,7 +45,7 @@
max_values_per_category = {cat: max(sales_data[group][i] for group in groups) for i, cat in enumerate(categories)}

bars = []
for i, (group, color) in enumerate(zip(groups, OKABE_ITO, strict=True)):
for i, (group, color) in enumerate(zip(groups, IMPRINT, strict=True)):
bar = ax.bar(
x + offsets[i], sales_data[group], bar_width, label=group, color=color, edgecolor=INK_SOFT, linewidth=1.5
)
Expand Down
4 changes: 2 additions & 2 deletions plots/bar-race-animated/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"
INK_MUTED = "#6B6A63" if THEME == "light" else "#A8A79F"

OKABE_ITO = ["#009E73", "#D55E00", "#0072B2", "#CC79A7", "#E69F00", "#56B4E9", "#F0E442"]
IMPRINT = ["#009E73", "#C475FD", "#4467A3", "#BD8233", "#AE3030", "#2ABCCD", "#954477"]

# Data: Tech Company Market Cap ($B) — year-end snapshots (2019–2024)
companies = ["Alphabet", "Amazon", "Apple", "Meta", "Microsoft", "Nvidia", "Tesla"]
company_colors = {c: OKABE_ITO[i] for i, c in enumerate(companies)}
company_colors = {c: IMPRINT[i] for i, c in enumerate(companies)}

market_cap = {
"Alphabet": [920, 1200, 1960, 1140, 1800, 2150],
Expand Down
2 changes: 1 addition & 1 deletion plots/bar-spine/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

# Colors: Okabe-Ito positions 1 and 2
COLOR_SURVIVED = "#009E73"
COLOR_DIED = "#D55E00"
COLOR_DIED = "#C475FD"

# Plot
fig, ax = plt.subplots(figsize=(16, 9), facecolor=PAGE_BG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
INK_MUTED = "#6B6A63" if THEME == "light" else "#A8A79F"

# Okabe-Ito palette (positions 1-4)
COLORS = ["#009E73", "#D55E00", "#0072B2", "#CC79A7"]
COLORS = ["#009E73", "#C475FD", "#4467A3", "#BD8233"]

# Data - Quarterly revenue by product category (in millions $)
np.random.seed(42)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"

# Okabe-Ito palette (first series is ALWAYS position 1)
OKABE_ITO = ["#009E73", "#D55E00", "#0072B2", "#CC79A7", "#E69F00"]
IMPRINT = ["#009E73", "#C475FD", "#4467A3", "#BD8233", "#AE3030"]

# Data: Energy mix by country (percentage of total electricity generation)
categories = ["Germany", "France", "UK", "Spain", "Italy", "Poland"]
Expand Down Expand Up @@ -49,7 +49,7 @@
bottom = np.zeros(len(categories))

# Create stacked bars
for i, (component, color) in enumerate(zip(components, OKABE_ITO, strict=True)):
for i, (component, color) in enumerate(zip(components, IMPRINT, strict=True)):
bars = ax.bar(
x, percentages[:, i], bar_width, bottom=bottom, label=component, color=color, edgecolor=PAGE_BG, linewidth=1.5
)
Expand Down
4 changes: 2 additions & 2 deletions plots/bar-stacked/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"

# Okabe-Ito palette (positions 1-4)
OKABE_ITO = ["#009E73", "#D55E00", "#0072B2", "#CC79A7"]
IMPRINT = ["#009E73", "#C475FD", "#4467A3", "#BD8233"]

# Data: Quarterly revenue by product category (in millions USD)
categories = ["Q1", "Q2", "Q3", "Q4"]
Expand All @@ -39,7 +39,7 @@
# Create stacked bars
bottom = np.zeros(len(categories))
for i, (product, values) in enumerate(zip(products, [software, hardware, services, support], strict=True)):
ax.bar(x, values, bar_width, label=product, bottom=bottom, color=OKABE_ITO[i], edgecolor=PAGE_BG, linewidth=1.5)
ax.bar(x, values, bar_width, label=product, bottom=bottom, color=IMPRINT[i], edgecolor=PAGE_BG, linewidth=1.5)
bottom += values

# Add total labels above each stacked bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
INK = "#1A1A17" if THEME == "light" else "#F0EFE8"
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"
BRAND = "#009E73" # Okabe-Ito position 1 — first categorical series
ACCENT2 = "#D55E00" # Okabe-Ito position 2 — for limits of agreement lines
ACCENT2 = "#C475FD" # Okabe-Ito position 2 — for limits of agreement lines

# Data: Simulated blood pressure readings from two sphygmomanometers
np.random.seed(42)
Expand Down
2 changes: 1 addition & 1 deletion plots/box-grouped/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"

# Okabe-Ito palette (positions 1-3 for three subcategories)
COLORS = ["#009E73", "#D55E00", "#0072B2"]
COLORS = ["#009E73", "#C475FD", "#4467A3"]

# Data - Employee performance scores across departments and experience levels
np.random.seed(42)
Expand Down
4 changes: 2 additions & 2 deletions plots/box-notched/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"

# Okabe-Ito palette - first series is always brand green
OKABE_ITO = ["#009E73", "#D55E00", "#0072B2", "#CC79A7", "#E69F00"]
IMPRINT = ["#009E73", "#C475FD", "#4467A3", "#BD8233", "#AE3030"]

# Data - Test success rates across different test suites
np.random.seed(42)
Expand Down Expand Up @@ -68,7 +68,7 @@
)

# Apply colors to boxes
for patch, color in zip(bp["boxes"], OKABE_ITO, strict=True):
for patch, color in zip(bp["boxes"], IMPRINT, strict=True):
patch.set_facecolor(color)
patch.set_alpha(0.75)
patch.set_edgecolor(INK_SOFT)
Expand Down
22 changes: 11 additions & 11 deletions plots/calibration-curve/implementations/python/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"

# Okabe-Ito palette - canonical order
OKABE_ITO = ["#009E73", "#D55E00", "#0072B2", "#CC79A7"]
BRAND = OKABE_ITO[0] # #009E73
IMPRINT = ["#009E73", "#C475FD", "#4467A3", "#BD8233"]
BRAND = IMPRINT[0] # #009E73

# Data
np.random.seed(42)
Expand Down Expand Up @@ -97,41 +97,41 @@

# Well-calibrated
ax1.fill_between(
prob_pred_cal, prob_true_cal - prob_std_cal, prob_true_cal + prob_std_cal, alpha=0.2, color=OKABE_ITO[0]
prob_pred_cal, prob_true_cal - prob_std_cal, prob_true_cal + prob_std_cal, alpha=0.2, color=IMPRINT[0]
)
ax1.plot(
prob_pred_cal,
prob_true_cal,
"o-",
color=OKABE_ITO[0],
color=IMPRINT[0],
linewidth=3,
markersize=10,
label=f"Well-Calibrated (Brier: {brier_cal:.3f})",
)

# Overconfident
ax1.fill_between(
prob_pred_over, prob_true_over - prob_std_over, prob_true_over + prob_std_over, alpha=0.2, color=OKABE_ITO[1]
prob_pred_over, prob_true_over - prob_std_over, prob_true_over + prob_std_over, alpha=0.2, color=IMPRINT[1]
)
ax1.plot(
prob_pred_over,
prob_true_over,
"s-",
color=OKABE_ITO[1],
color=IMPRINT[1],
linewidth=3,
markersize=10,
label=f"Overconfident (Brier: {brier_over:.3f})",
)

# Underconfident
ax1.fill_between(
prob_pred_under, prob_true_under - prob_std_under, prob_true_under + prob_std_under, alpha=0.2, color=OKABE_ITO[2]
prob_pred_under, prob_true_under - prob_std_under, prob_true_under + prob_std_under, alpha=0.2, color=IMPRINT[2]
)
ax1.plot(
prob_pred_under,
prob_true_under,
"^-",
color=OKABE_ITO[2],
color=IMPRINT[2],
linewidth=3,
markersize=10,
label=f"Underconfident (Brier: {brier_under:.3f})",
Expand Down Expand Up @@ -159,13 +159,13 @@

# Histogram
ax2.hist(
y_prob_calibrated, bins=20, alpha=0.6, color=OKABE_ITO[0], label="Well-Calibrated", edgecolor=PAGE_BG, linewidth=0.5
y_prob_calibrated, bins=20, alpha=0.6, color=IMPRINT[0], label="Well-Calibrated", edgecolor=PAGE_BG, linewidth=0.5
)
ax2.hist(
y_prob_overconfident,
bins=20,
alpha=0.6,
color=OKABE_ITO[1],
color=IMPRINT[1],
label="Overconfident",
edgecolor=PAGE_BG,
linewidth=0.5,
Expand All @@ -174,7 +174,7 @@
y_prob_underconfident,
bins=20,
alpha=0.6,
color=OKABE_ITO[2],
color=IMPRINT[2],
label="Underconfident",
edgecolor=PAGE_BG,
linewidth=0.5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# Okabe-Ito palette
UP_COLOR = "#009E73" # Brand green (up days)
DOWN_COLOR = "#D55E00" # Vermillion (down days)
DOWN_COLOR = "#C475FD" # Vermillion (down days)

# Data - Generate realistic 60 trading days of OHLC data with volume
np.random.seed(42)
Expand Down
Loading
Loading