Skip to content

Commit 7ab4dfb

Browse files
committed
add line styles in legend
1 parent 876205e commit 7ab4dfb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

climada/hazard/tc_tracks.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def plot(self, title=None):
240240
min_lat-deg_border, max_lat+deg_border]))
241241
plot.add_shapes(axis)
242242

243+
synth_flag = False
243244
cmap = ListedColormap(colors=CAT_COLORS)
244245
norm = BoundaryNorm([0] + SAFFIR_SIM_CAT, len(SAFFIR_SIM_CAT))
245246
if title:
@@ -252,6 +253,7 @@ def plot(self, title=None):
252253
track_lc = LineCollection(segments, cmap=cmap, norm=norm, \
253254
linestyle='solid', transform=ccrs.PlateCarree(), lw=2)
254255
else:
256+
synth_flag = True
255257
track_lc = LineCollection(segments, cmap=cmap, norm=norm, \
256258
linestyle=':', transform=ccrs.PlateCarree(), lw=2)
257259
track_lc.set_array(track.max_sustained_wind.values)
@@ -261,6 +263,12 @@ def plot(self, title=None):
261263
for i_col in range(len(SAFFIR_SIM_CAT))]
262264
leg_names = [CAT_NAMES[i_col] for i_col
263265
in range(1, len(SAFFIR_SIM_CAT)+1)]
266+
if synth_flag:
267+
leg_lines.append(Line2D([0], [0], color='grey', lw=2, ls='solid'))
268+
leg_lines.append(Line2D([0], [0], color='grey', lw=2, ls=':'))
269+
leg_names.append('Historical')
270+
leg_names.append('Synthetic')
271+
264272
axis.legend(leg_lines, leg_names)
265273
return fig, axis
266274

0 commit comments

Comments
 (0)