| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4dadbe3 commit a5cd938
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5122,8 +5122,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None, | |||
| 5122 | 5122 | ||
| 5123 | 5123 | temp = np.asarray(X) | |
| 5124 | 5124 | if temp.ndim == 3 and isinstance(norm, mcolors.BivariateNorm): | |
| 5125 | - temp = norm(temp) | ||
| 5126 | - X = cmap(temp, alpha=self.get_alpha(), bytes=True) | ||
| 5125 | + X = norm(temp) | ||
| 5127 | 5126 | ||
| 5128 | 5127 | if not self._hold: | |
| 5129 | 5128 | self.cla() | |
@@ -5760,7 +5759,6 @@ def pcolorfast(self, *args, **kwargs): | |||
| 5760 | 5759 | if (C.ndim == 3 and isBivari): | |
| 5761 | 5760 | C = norm(C) | |
| 5762 | 5761 | nr, nc = C.shape | |
| 5763 | - C = cmap(C, alpha=alpha, bytes=True) | ||
| 5764 | 5762 | else: | |
| 5765 | 5763 | nr, nc = C.shape | |
| 5766 | 5764 | if len(args) == 1: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -859,18 +859,18 @@ def reversed(self, name=None): | |||
| 859 | 859 | class BivariateColormap(Colormap): | |
| 860 | 860 | def __init__(self, name='bivariate', N=256): | |
| 861 | 861 | Colormap.__init__(self, name, N) | |
| 862 | + self.N = self.N * self.N | ||
| 862 | 863 | ||
| 863 | 864 | def _init(self): | |
| 864 | - red = np.linspace(0, 1, self.N) | ||
| 865 | - green = np.linspace(0, 1, self.N) | ||
| 865 | + red = np.linspace(0, 1, np.sqrt(self.N)) | ||
| 866 | + green = np.linspace(0, 1, np.sqrt(self.N)) | ||
| 866 | 867 | red_mesh, green_mesh = np.meshgrid(red, green) | |
| 867 | 868 | blue_mesh = np.zeros_like(red_mesh) | |
| 868 | 869 | alpha_mesh = np.ones_like(red_mesh) | |
| 869 | 870 | bivariate_cmap = np.dstack((red_mesh, green_mesh, blue_mesh, | |
| 870 | 871 | alpha_mesh)) | |
| 871 | 872 | self._lut = np.vstack(bivariate_cmap) | |
| 872 | 873 | self._isinit = True | |
| 873 | - self.N = self.N * self.N | ||
| 874 | 874 | self._set_extremes() | |
| 875 | 875 | ||
| 876 | 876 | def _resample(self, lutsize): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -362,7 +362,8 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0, | |||
| 362 | 362 | raise ValueError("Invalid dimensions, got {}".format(A.shape)) | |
| 363 | 363 | ||
| 364 | 364 | if A.ndim == 2: | |
| 365 | - A = self.norm(A) | ||
| 365 | + if not isinstance(self.norm, mcolors.BivariateNorm): | ||
| 366 | + A = self.norm(A) | ||
| 366 | 367 | if A.dtype.kind == 'f': | |
| 367 | 368 | # If the image is greyscale, convert to RGBA and | |
| 368 | 369 | # use the extra channels for resizing the over, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments