8000 Make new colormaps full-fledged citizens by mdboom · Pull Request #5283 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Make new colormaps full-fledged citizens #5283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 22, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename reduce -> resample
  • Loading branch information
mdboom committed Oct 20, 2015
commit 613157d07ed31a3a5a5acb93a90eba3ed3478993
2 changes: 1 addition & 1 deletion lib/matplotlib/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def get_cmap(name=None, lut=None):
if lut is None:
return cmap_d[name]
else:
return cmap_d[name].reduce(lut)
return cmap_d[name].resample(lut)
else:
raise ValueError(
"Colormap %s is not recognized. Possible values are: %s"
Expand Down
12 changes: 6 additions & 6 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,9 @@ def is_gray(self):
return (np.alltrue(self._lut[:, 0] == self._lut[:, 1]) and
np.alltrue(self._lut[:, 0] == self._lut[:, 2]))

def reduce(self, lutsize):
def resample(self, lutsize):
"""
Return a new color map with the *lutsize* entries.
Return a new color map with *lutsize* entries.
"""
raise NotImplementedError()

Expand Down Expand Up @@ -778,9 +778,9 @@ def from_list(name, colors, N=256, gamma=1.0):

return LinearSegmentedColormap(name, cdict, N, gamma)

def reduce(self, lutsize):
def resample(self, lutsize):
"""
Return a new color map with the *lutsize* entries.
Return a new color map with *lutsize* entries.
"""
return LinearSegmentedColormap(self.name, self._segmentdata, lutsize)

Expand Down Expand Up @@ -848,9 +848,9 @@ def _init(self):
self._isinit = True
self._set_extremes()

def reduce(self, lutsize):
def resample(self, lutsize):
"""
Return a new color map with the *lutsize* entries.
Return a new color map with *lutsize* entries.
"""
return ListedColormap(self.name, self.colors, lutsize)

Expand Down
0