Skip to content

Commit 2da6516

Browse files
committed
nicer price graphs
1 parent 4288f46 commit 2da6516

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed
2.34 KB
Loading

src/towns/ware-prices/buying-price.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,18 @@ def plot_example1():
9191
raise Exception(f"At {stock} stock, we have an increase in price")
9292

9393
ax1.plot(x, t0_pigiron_y)
94-
# """
94+
9595
ax1.axvline(SAMPLE_THRESHOLDS[0])
96-
ax1.text(SAMPLE_THRESHOLDS[0], 0, "$t_0$", va="bottom")
96+
ax1.annotate("$t_0$", xy=(SAMPLE_THRESHOLDS[0], ax1.get_ylim()[1]), xycoords='data', xytext=(2, -10), textcoords='offset points')
9797
ax1.axvline(SAMPLE_THRESHOLDS[1])
98-
ax1.text(SAMPLE_THRESHOLDS[1], 0, "$t_1$", va="bottom")
98+
ax1.annotate("$t_1$", xy=(SAMPLE_THRESHOLDS[1], ax1.get_ylim()[1]), xycoords='data', xytext=(2, -10), textcoords='offset points')
9999
ax1.axvline(SAMPLE_THRESHOLDS[2])
100-
ax1.text(SAMPLE_THRESHOLDS[2], 0, "$t_2$", va="bottom")
100+
ax1.annotate("$t_2$", xy=(SAMPLE_THRESHOLDS[2], ax1.get_ylim()[1]), xycoords='data', xytext=(2, -10), textcoords='offset points')
101101
ax1.axvline(SAMPLE_THRESHOLDS[3])
102-
ax1.text(SAMPLE_THRESHOLDS[3], 0, "$t_3$", va="bottom")
103-
# """
102+
ax1.annotate("$t_3$", xy=(SAMPLE_THRESHOLDS[3], ax1.get_ylim()[1]), xycoords='data', xytext=(2, -10), textcoords='offset points')
103+
104+
ax1.axhline(PIG_IRON_BASE_PRICE * 2000)
105+
ax1.annotate("Base Price", xy=(0, PIG_IRON_BASE_PRICE * 2000), xycoords='data', xytext=(2, -10), textcoords='offset points')
104106

105107
ax1.set_title("Buying Price of 1 Pigiron Bundle")
106108
ax1.set_xlabel("Stock")
3.45 KB
Loading

src/towns/ware-prices/selling-price.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,18 @@ def plot_example1():
120120
ax1.plot(x, t0_pigiron_difficulty0_y, label="low")
121121
ax1.plot(x, t0_pigiron_difficulty1_y, label="normal")
122122
ax1.plot(x, t0_pigiron_difficulty2_y, label="high")
123-
# """
123+
124124
ax1.axvline(SAMPLE_THRESHOLDS[0])
125-
ax1.text(SAMPLE_THRESHOLDS[0], 0, "$t_0$", va="bottom")
125+
ax1.annotate("$t_0$", xy=(SAMPLE_THRESHOLDS[0], ax1.get_ylim()[1]), xycoords='data', xytext=(2, -10), textcoords='offset points')
126126
ax1.axvline(SAMPLE_THRESHOLDS[1])
127-
ax1.text(SAMPLE_THRESHOLDS[1], 0, "$t_1$", va="bottom")
127+
ax1.annotate("$t_1$", xy=(SAMPLE_THRESHOLDS[1], ax1.get_ylim()[1]), xycoords='data', xytext=(2, -10), textcoords='offset points')
128128
ax1.axvline(SAMPLE_THRESHOLDS[2])
129-
ax1.text(SAMPLE_THRESHOLDS[2], 0, "$t_2$", va="bottom")
129+
ax1.annotate("$t_2$", xy=(SAMPLE_THRESHOLDS[2], ax1.get_ylim()[1]), xycoords='data', xytext=(2, -10), textcoords='offset points')
130130
ax1.axvline(SAMPLE_THRESHOLDS[3])
131-
ax1.text(SAMPLE_THRESHOLDS[3], 0, "$t_3$", va="bottom")
132-
# """
131+
ax1.annotate("$t_3$", xy=(SAMPLE_THRESHOLDS[3], ax1.get_ylim()[1]), xycoords='data', xytext=(2, -10), textcoords='offset points')
132+
133+
ax1.axhline(PIG_IRON_BASE_PRICE * 2000)
134+
ax1.annotate("Base Price", xy=(0, PIG_IRON_BASE_PRICE * 2000), xycoords='data', xytext=(2, -10), textcoords='offset points')
133135

134136
ax1.set_title("Selling Price of 1 Pigiron Bundle per Difficulty")
135137
ax1.set_xlabel("Stock")

0 commit comments

Comments
 (0)