Skip to content

Commit 5cd8403

Browse files
committed
Update _axes.py for broadcasting bug
1 parent 4e62e16 commit 5cd8403

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/tikzplotlib/_axes.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,13 @@ def _handle_listed_color_map(cmap, data):
789789
# 'winter': 'winter',
790790
}
791791
for mpl_cm, pgf_cm in cm_translate.items():
792-
if cmap.colors == plt.get_cmap(mpl_cm).colors:
793-
is_custom_colormap = False
794-
return (pgf_cm, is_custom_colormap)
792+
try:
793+
if cmap.colors == plt.get_cmap(mpl_cm).colors:
794+
is_custom_colormap = False
795+
return (pgf_cm, is_custom_colormap)
796+
except ValueError:
797+
# might happen if cmap.colors cannot be broadcast against plt.get_cmap(mpl_cm).colors as an np array, in which case they are definitely not equal
798+
pass
795799

796800
unit = "pt"
797801
ff = data["float format"]

0 commit comments

Comments
 (0)