Skip to content

Commit da9e87c

Browse files
committed
Fix some floating-point arithmetic issues for low-N.
1 parent 50d1bb0 commit da9e87c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/colors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def join_colormaps(cmaps, fractions=None, name=None, N=None):
147147
for cm in cmaps:
148148
name += cm.name + '+'
149149
name.rstrip('+')
150-
maps = [cm(np.linspace(0, 1, int(N * frac)))
150+
maps = [cm(np.linspace(0, 1, int(round(N * frac))))
151151
for cm, frac in zip(cmaps, fractions)]
152152
# N is set by len of the vstack'd array:
153153
return ListedColormap(np.vstack(maps), name, )

0 commit comments

Comments
 (0)