X Tutup
Skip to content
Closed
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
3 changes: 3 additions & 0 deletions lib/matplotlib/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ def to_rgba(self, x, alpha=None, bytes=False):
xx = x
else:
raise ValueError("third dimension must be 3 or 4")
if xx.dtype != np.uint8 and xx.max() > 1:
raise ValueError(
"image must be either uint8 or in the 0..1 range")
if bytes and xx.dtype != np.uint8:
xx = (xx * 255).astype(np.uint8)
if not bytes and xx.dtype == np.uint8:
Expand Down
X Tutup