Skip to content

Clarify docstring of ScalarMappable.set/get_array() #20238

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 1 commit into from
May 16, 2021
Merged
Changes from all commits
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
13 changes: 11 additions & 2 deletions lib/matplotlib/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,15 @@ def to_rgba(self, x, alpha=None, bytes=False, norm=True):

def set_array(self, A):
"""
Set the image array from array-like *A*.
Set the value array from array-like *A*.

Parameters
----------
A : array-like or None
The values that are mapped to colors.

The base class `.ScalarMappable` does not make any assumptions on
the dimensionality and shape of the value array *A*.
"""
if A is None:
self._A = None
Expand All @@ -379,7 +383,12 @@ def set_array(self, A):
self._A = A

def get_array(self):
"""Return the data array."""
"""
Return the array of values, that are mapped to colors.

The base class `.ScalarMappable` does not make any assumptions on
the dimensionality and shape of the array.
"""
return self._A

def get_cmap(self):
Expand Down