Skip to content

Commit 3449efa

Browse files
committed
labels
1 parent cdeb2ad commit 3449efa

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/towns/population/levels.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def plot_example1():
8585
plt.clf()
8686
labels = ["Rich", "Wealthy", "Poor"]
8787
fig, (axs) = plt.subplots(1, 4, sharey="all", sharex="all", figsize=(10, 4))
88-
plot_example1_subplot(axs[0], 5, False)
88+
plot_example1_subplot(axs[0], 5, False, True)
8989
plot_example1_subplot(axs[1], 5, True)
9090
plot_example1_subplot(axs[2], 80, False)
9191
plot_example1_subplot(axs[3], 80, True)
@@ -105,7 +105,7 @@ def plot_example1():
105105
plt.savefig("levels1.png", dpi=100, bbox_inches="tight")
106106

107107

108-
def plot_example1_subplot(ax, satisfaction: int, has_mint: bool):
108+
def plot_example1_subplot(ax, satisfaction: int, has_mint: bool, label: bool = False):
109109
ax.grid(axis="y")
110110
town = Town(50, 50, 900, satisfaction, satisfaction, satisfaction, has_mint)
111111
x = []
@@ -124,12 +124,10 @@ def plot_example1_subplot(ax, satisfaction: int, has_mint: bool):
124124
ax.plot(x, sat_y_rich, label="Rich")
125125
ax.plot(x, sat_y_wealthy, label="Wealthy")
126126
ax.plot(x, sat_y_poor, label="Poor")
127+
ax.set_xlabel("Days")
128+
if label:
129+
ax.set_ylabel("Inhabitants (absolute)")
127130
ax.set_title(f"{satisfaction} Satisfaction {"(Mint)" if has_mint else "(no Mint)"}")
128131

129132

130-
def plot_example2():
131-
pass
132-
133-
134133
plot_example1()
135-
plot_example2()

src/towns/population/levels1.png

4.29 KB
Loading

0 commit comments

Comments
 (0)