Skip to content

Commit b0b3dd4

Browse files
committed
fix the case when there is no legend
1 parent d83e492 commit b0b3dd4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pandas/tools/rplot.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,9 @@ def adjust_subplots(fig, axes, trellis, layers):
773773
legend = dictionary_union(legend, layer.legend)
774774
patches = []
775775
labels = []
776-
if len(legend.keys()[0]) == 2:
776+
if len(legend.keys()) == 0:
777+
key_function = lambda tup: tup
778+
elif len(legend.keys()[0]) == 2:
777779
key_function = lambda tup: (tup[1])
778780
else:
779781
key_function = lambda tup: (tup[1], tup[3])
@@ -843,7 +845,9 @@ def render(self, fig=None):
843845
legend = dictionary_union(legend, layer.legend)
844846
patches = []
845847
labels = []
846-
if len(legend.keys()[0]) == 2:
848+
if len(legend.keys()) == 0:
849+
key_function = lambda tup: tup
850+
elif len(legend.keys()[0]) == 2:
847851
key_function = lambda tup: (tup[1])
848852
else:
849853
key_function = lambda tup: (tup[1], tup[3])

0 commit comments

Comments
 (0)