Skip to content

Commit 60fd483

Browse files
committed
Modified to avoid KeyError
1 parent bd88e5b commit 60fd483

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

patchworklib/patchworklib.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,10 @@ def draw_labels(bricks, gcp):
291291
def draw_legend(bricks, gori, gcp, figsize):
292292
get_property = gcp.theme.themeables.property
293293
legend_box = gcp.guides.build(gcp)
294-
with suppress(KeyError):
294+
try:
295295
spacing = get_property('legend_box_spacing')
296+
except KeyError:
297+
spacing = 0.1
296298
position = gori.guides.position
297299
if position == 'right':
298300
loc = 6
@@ -347,8 +349,12 @@ def draw_title(bricks, gcp, figsize):
347349
pad = 3
348350
else:
349351
pad = margin.get_as('b', 'in') / 0.09,
350-
bricks._case.set_title(title, pad=pad[0], fontsize=fontsize)
351-
352+
353+
if type(pad) in (list, tuple):
354+
bricks._case.set_title(title, pad=pad[0], fontsize=fontsize)
355+
else:
356+
bricks._case.set_title(title, pad=pad, fontsize=fontsize)
357+
352358
#save_original_position
353359
global _axes_dict
354360
position_dict = {}

0 commit comments

Comments
 (0)