Skip to content

Commit d168739

Browse files
committed
Add line labels and remove dotted tx line
1 parent 72b126d commit d168739

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

papers/Martin_Staadecker_Value_of_LDES_and_Factors/LDES_paper_graphs/Figure impact of LDES on grid.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from matplotlib import cm
88
from matplotlib.ticker import PercentFormatter
99
from matplotlib.colors import Normalize
10+
import labellines
1011

1112
from papers.Martin_Staadecker_Value_of_LDES_and_Factors.LDES_paper_graphs.util import (
1213
set_style,
@@ -83,13 +84,13 @@
8384
# Convert to percent against baseline
8485
df = (df / df.iloc[0] - 1) * 100
8586

86-
dotted_tx = df.loc[[1.94, 3, 20, 64], ["Built Transmission"]]
87+
# dotted_tx = df.loc[[1.94, 3, 20, 64], ["Built Transmission"]]
8788

8889
# Plot
8990
colors = tools.get_colors()
9091
colors["Built Transmission"] = "y"
9192
colors["Built Generation"] = "r"
92-
dotted_tx.plot(ax=ax, linestyle="dashed", color="y", alpha=0.8)
93+
# dotted_tx.plot(ax=ax, linestyle="dashed", color="y", alpha=0.8)
9394
df.plot(ax=ax, marker=".", color=colors)
9495
ax.set_ylabel("Change in capacity compared to baseline")
9596
ax.yaxis.set_major_formatter(PercentFormatter())
@@ -178,8 +179,24 @@
178179
fraction=0.1,
179180
)
180181

181-
lines = ax.plot(demand, c="dimgray", linestyle="--", alpha=0.5)
182-
ax.legend(lines, ["Demand"])
182+
lines = ax.get_lines()
183+
x_label = {
184+
4.0: 135,
185+
8.0: 150,
186+
20.0: 170,
187+
24.0: 230,
188+
32.0: 245,
189+
48.0: 260,
190+
64.0: 285
191+
}
192+
for line in lines:
193+
label = float(line.get_label())
194+
if label not in x_label.keys():
195+
continue
196+
labellines.labelLine(line, state_of_charge.index[x_label[label]], label=str(int(label)), align=False, color='k')
197+
198+
demand_lines = ax.plot(demand, c="dimgray", linestyle="--", alpha=0.5)
199+
ax.legend(demand_lines, ["Demand"])
183200

184201
ax.set_title("C. State of charge throughout the year")
185202
# %%
@@ -200,5 +217,6 @@
200217
cap / cap.loc[20] - 1 # solar increase %
201218
(cap - cap.loc[20]) / 1000
202219
# %% transmission
203-
tx / tx.iloc[0] * 100
204-
(3 - 1.94) * 1000 / ((1 - tx.loc[3] / tx.iloc[0]) * 100)
220+
100 - tx / tx.iloc[0] * 100
221+
# (3 - 1.94) * 1000 / ((1 - tx.loc[3] / tx.iloc[0]) * 100)
222+

0 commit comments

Comments
 (0)