8000 Add the __add__ method, and doc. · matplotlib/matplotlib@8799485 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

8000
Appearance settings

Commit 8799485

Browse files
committed
Add the __add__ method, and doc.
1 parent 0671f71 commit 8799485

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/matplotlib/colors.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,11 @@ def join(self, other, name=None, frac_self=None, N=None):
625625
# Note that `joined_cmap` will be 2/3 `cmap1`, and 1/3 `cmap2`
626626
# because of the default behavior of frac_self
627627
# (i.e. proportional to N of each cmap).
628+
629+
# This is also available as :meth:`Colormap.__add__`, so that
630+
# the following is possible:
631+
632+
joined_cmap = cmap1 + cmap2
628633
"""
629634
if N is None:
630635
N = self.N + other.N
@@ -639,6 +644,8 @@ def join(self, other, name=None, frac_self=None, N=None):
639644
# N is set by len of the vstack'd array:
640645
return ListedColormap(np.vstack((map0, map1)), name, )
641646

647+
__add__ = join
648+
642649
def truncate(self, minval=0.0, maxval=1.0, N=None):
643650
"""
644651
Truncate a colormap.

0 commit comments

Comments
 (0)
0