Skip to content

Commit b417a29

Browse files
committed
Use handle.get_array to get mappable information
Due to inconsistencies in the colormap setup, it is suggested to instead check for `get_array` to get an array of values to be color mapped. This check is more robust irrespective of whatever the type of colormap is set to be.
1 parent 8998cbc commit b417a29

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ def val_or_rc(val, rc_name):
563563
getter_names = color_getters[labelcolor]
564564
for handle, text in zip(self.legendHandles, self.texts):
565565
try:
566-
if isinstance(handle.cmap, colors.LinearSegmentedColormap):
566+
if handle.get_array() is not None:
567567
continue
568568
except AttributeError:
569569
pass

0 commit comments

Comments
 (0)