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

New data → color pipeline#28658

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 18 commits intomatplotlib:mainfromtrygvrad:Colorizer-class
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
18 commits
Select commitHold shift + click to select a range
1e52ba8
Colorizer class
trygvradAug 2, 2024
9e5620d
Creation of colorizer.py
trygvradAug 6, 2024
b3f5260
updated ColorizingArtist.__init__
trygvradAug 7, 2024
edbe127
simplify to_rgba() by extracting the part relating to RGBA data
trygvradAug 9, 2024
fc9973e
updated class hierarchy for Colorizer
trygvradAug 13, 2024
596daec
colorizer keyword on plotting functions with typing
trygvradAug 13, 2024
21a5a64
changes to keyword parameter ordering
trygvradAug 16, 2024
5755d1b
adjustments based on code review
trygvradAug 21, 2024
a6fe9e8
MNT: adjust inheritance so isinstance(..., cm.ScalarMappable) works
tacaswellAug 21, 2024
dbe8cc3
updated docs with colorizer changes
trygvradAug 21, 2024
9ac2739
updates to colorizer pipeline based on feedback from @QuLogic
trygvradAug 27, 2024
7dd31ad
DOC: fix unrelated xref issues
tacaswellAug 29, 2024
1ecfe95
DOC: add multivariate colormaps to the docs
tacaswellAug 29, 2024
c685f36
DOC: fix colorizer related xrefs
tacaswellAug 29, 2024
676a31f
DOC: auto-generate ScalarMappable in conf.py
tacaswellAug 29, 2024
c3cad60
Corrections based on feedback from @QuLogic
trygvradSep 6, 2024
269ace9
MNT: Touch up rebase to use 'register' for docstring interpolations
ksundenOct 11, 2024
336a9ba
fix missing refererence linenos
ksundenOct 23, 2024
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
PrevPrevious commit
NextNext commit
updates to colorizer pipeline based on feedback from@QuLogic
  • Loading branch information
@trygvrad@ksunden
trygvrad authored andksunden committedOct 18, 2024
commit9ac27392b7bc211090d721f65dae14bdfd3b3218
2 changes: 1 addition & 1 deletionlib/matplotlib/axes/_axes.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -439,8 +439,8 @@ class Axes(_AxesBase):
reduce_C_function: Callable[[np.ndarray | list[float]], float] = ...,
mincnt: int | None = ...,
marginals: bool = ...,
data=...,
colorizer: Colorizer | None = ...,
data=...,
**kwargs
) -> PolyCollection: ...
def arrow(
Expand Down
3 changes: 1 addition & 2 deletionslib/matplotlib/collections.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,6 @@ from numpy.typing import ArrayLike, NDArray
from . import colorizer, transforms
from .backend_bases import MouseEvent
from .artist import Artist
from .colorizer import Colorizer
from .colors import Normalize, Colormap
from .lines import Line2D
from .path import Path
Expand All@@ -31,7 +30,7 @@ class Collection(colorizer.ColorizingArtist):
offset_transform: transforms.Transform | None = ...,
norm: Normalize | None = ...,
cmap: Colormap | None = ...,
colorizer: Colorizer | None = ...,
colorizer:colorizer.Colorizer | None = ...,
pickradius: float = ...,
hatch: str | None = ...,
urls: Sequence[str] | None = ...,
Expand Down
2 changes: 1 addition & 1 deletionlib/matplotlib/colorbar.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -498,7 +498,7 @@ def update_normal(self, mappable=None):
# [ColorizingArtist.changed() emits self.callbacks.process('changed')]
# Also, there is no test where self.mappable == mappable is not True
# and possibly no use case.
# Therefore, the mappable keyword can bedepreciated if cm.ScalarMappable
# Therefore, the mappable keyword can bedeprecated if cm.ScalarMappable
# is removed.
self.mappable = mappable
_log.debug('colorbar update normal %r %r', self.mappable.norm, self.norm)
Expand Down
15 changes: 0 additions & 15 deletionslib/matplotlib/colorizer.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -192,21 +192,6 @@ def _pass_image_data(x, alpha=None, bytes=False, norm=True):
xx[np.any(np.ma.getmaskarray(x), axis=2), 3] = 0
return xx

def normalize(self, x):
"""
Normalize the data in x.

Parameters
----------
x : np.array

Returns
-------
np.array

"""
return self.norm(x)

def autoscale(self, A):
"""
Autoscale the scalar limits on the norm instance using the
Expand Down
17 changes: 7 additions & 10 deletionslib/matplotlib/colorizer.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,13 +5,13 @@ import numpy as np
from numpy.typing import ArrayLike


class Colorizer():
class Colorizer:
colorbar: colorbar.Colorbar | None
callbacks: cbook.CallbackRegistry
def __init__(
self,
norm: colors.Normalize | str | None = ...,
cmap: str | colors.Colormap | None = ...,
norm: str | colors.Normalize | None = ...,
) -> None: ...
@property
def norm(self) -> colors.Normalize: ...
Expand All@@ -24,12 +24,6 @@ class Colorizer():
bytes: bool = ...,
norm: bool = ...,
) -> np.ndarray: ...
@overload
def normalize(self, value: float, clip: bool | None = ...) -> float: ...
@overload
def normalize(self, value: np.ndarray, clip: bool | None = ...) -> np.ma.MaskedArray: ...
@overload
def normalize(self, value: ArrayLike, clip: bool | None = ...) -> ArrayLike: ...
def autoscale(self, A: ArrayLike) -> None: ...
def autoscale_None(self, A: ArrayLike) -> None: ...
@property
Expand DownExpand Up@@ -83,6 +77,9 @@ class _ScalarMappable(_ColorizerInterface):
self,
norm: colors.Normalize | None = ...,
cmap: str | colors.Colormap | None = ...,
*,
colorizer: Colorizer | None = ...,
**kwargs
) -> None: ...
def set_array(self, A: ArrayLike | None) -> None: ...
def get_array(self) -> np.ndarray | None: ...
Expand All@@ -93,8 +90,8 @@ class ColorizingArtist(_ScalarMappable, artist.Artist):
callbacks: cbook.CallbackRegistry
def __init__(
self,
norm: colors.Normalize | None = ...,
cmap: str | colors.Colormap | None = ...,
colorizer: Colorizer,
**kwargs
) -> None: ...
def set_array(self, A: ArrayLike | None) -> None: ...
def get_array(self) -> np.ndarray | None: ...
Expand Down
12 changes: 6 additions & 6 deletionslib/matplotlib/figure.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2972,8 +2972,8 @@ def set_canvas(self, canvas):

@_docstring.interpd
def figimage(self, X, xo=0, yo=0, alpha=None, norm=None, cmap=None,
vmin=None, vmax=None,colorizer=None,origin=None, resize=False,
**kwargs):
vmin=None, vmax=None, origin=None, resize=False, *,
colorizer=None,**kwargs):
"""
Add a non-resampled image to the figure.

Expand DownExpand Up@@ -3009,17 +3009,17 @@ def figimage(self, X, xo=0, yo=0, alpha=None, norm=None, cmap=None,

This parameter is ignored if *X* is RGB(A).

%(colorizer_doc)s

This parameter is ignored if *X* is RGB(A).

origin : {'upper', 'lower'}, default: :rc:`image.origin`
Indicates where the [0, 0] index of the array is in the upper left
or lower left corner of the Axes.

resize : bool
If *True*, resize the figure to match the given image size.

%(colorizer_doc)s

This parameter is ignored if *X* is RGB(A).

Returns
-------
`matplotlib.image.FigureImage`
Expand Down
3 changes: 2 additions & 1 deletionlib/matplotlib/figure.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -368,9 +368,10 @@ class Figure(FigureBase):
cmap: str | Colormap | None = ...,
vmin: float | None = ...,
vmax: float | None = ...,
colorizer: Colorizer | None = ...,
origin: Literal["upper", "lower"] | None = ...,
resize: bool = ...,
*,
colorizer: Colorizer | None = ...,
**kwargs
) -> FigureImage: ...
def set_size_inches(
Expand Down
1 change: 1 addition & 0 deletionslib/matplotlib/meson.build
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,6 +103,7 @@ typing_sources = [
'cm.pyi',
'collections.pyi',
'colorbar.pyi',
'colorizer.pyi',
'colors.pyi',
'container.pyi',
'contour.pyi',
Expand Down
5 changes: 3 additions & 2 deletionslib/matplotlib/pyplot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2723,9 +2723,10 @@ def figimage(
cmap: str | Colormap | None = None,
vmin: float | None = None,
vmax: float | None = None,
colorizer: Colorizer | None = None,
origin: Literal["upper", "lower"] | None = None,
resize: bool = False,
*,
colorizer: Colorizer | None = None,
**kwargs,
) -> FigureImage:
return gcf().figimage(
Expand All@@ -2737,9 +2738,9 @@ def figimage(
cmap=cmap,
vmin=vmin,
vmax=vmax,
colorizer=colorizer,
origin=origin,
resize=resize,
colorizer=colorizer,
**kwargs,
)

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp