Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitdcf6f8a

Browse files
committed
improved docstring for SegmentedBivarColormap()
also allows SegmentedBivarColormap to take non-square patches.This was easier that testing that the input is always square.
1 parent438923f commitdcf6f8a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎lib/matplotlib/colors.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -760,9 +760,10 @@ def _get_rgba_and_mask(self, X, alpha=None, bytes=False):
760760
761761
Returns
762762
-------
763-
colors : array of RGBA values with a shape of ``X.shape + (4, )``.
764-
mask : boolean array with True where the input is ``np.nan`` or
765-
masked.
763+
colors : np.ndarray
764+
Array of RGBA values with a shape of ``X.shape + (4, )``.
765+
mask : np.ndarray
766+
Boolean array with True where the input is ``np.nan`` or masked.
766767
"""
767768
ifnotself._isinit:
768769
self._init()
@@ -2016,8 +2017,9 @@ class SegmentedBivarColormap(BivarColormap):
20162017
20172018
Parameters
20182019
----------
2019-
patch : np.array of shape (k, k, 3)
2020-
This patch gets supersampled to a lut of shape (N, M, 4).
2020+
patch : np.array
2021+
Patch is required to have a shape (k, l, 3), and will get supersampled
2022+
to a lut of shape (N, N, 4).
20212023
N : int
20222024
The number of RGB quantization levels along each axis.
20232025
shape : {'square', 'circle', 'ignore', 'circleignore'}
@@ -2051,7 +2053,7 @@ def _init(self):
20512053
_patch[:, :, :3]=self.patch
20522054
_patch[:, :,3]=1
20532055
transform=mpl.transforms.Affine2D().translate(-0.5,-0.5)\
2054-
.scale(self.N/ (s[0]-1),self.N/ (s[0]-1))
2056+
.scale(self.N/ (s[1]-1),self.N/ (s[0]-1))
20552057
self._lut=np.empty((self.N,self.N,4))
20562058

20572059
_image.resample(_patch,self._lut,transform,_image.BILINEAR,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp