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

Commiteeb895c

Browse files
committed
Changes to colorizer to prepare for multivariate plotting
1 parent6985111 commiteeb895c

File tree

5 files changed

+288
-74
lines changed

5 files changed

+288
-74
lines changed

‎lib/matplotlib/cbook.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,17 @@ def safe_masked_invalid(x, copy=False):
690690
try:
691691
xm=np.ma.masked_where(~(np.isfinite(x)),x,copy=False)
692692
exceptTypeError:
693-
returnx
693+
iflen(x.dtype.descr)==1:
694+
returnx
695+
else:
696+
# in case of a dtype with multiple fields:
697+
try:
698+
mask=np.empty(x.shape,dtype=np.dtype('bool, '*len(x.dtype.descr)))
699+
fordd,dminzip(x.dtype.descr,mask.dtype.descr):
700+
mask[dm[0]]=~(np.isfinite(x[dd[0]]))
701+
xm=np.ma.array(x,mask=mask,copy=False)
702+
exceptTypeError:
703+
returnx
694704
returnxm
695705

696706

‎lib/matplotlib/cm.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -278,32 +278,3 @@ def get_cmap(name=None, lut=None):
278278
return_colormaps[name]
279279
else:
280280
return_colormaps[name].resampled(lut)
281-
282-
283-
def_ensure_cmap(cmap):
284-
"""
285-
Ensure that we have a `.Colormap` object.
286-
287-
For internal use to preserve type stability of errors.
288-
289-
Parameters
290-
----------
291-
cmap : None, str, Colormap
292-
293-
- if a `Colormap`, return it
294-
- if a string, look it up in mpl.colormaps
295-
- if None, look up the default color map in mpl.colormaps
296-
297-
Returns
298-
-------
299-
Colormap
300-
301-
"""
302-
ifisinstance(cmap,colors.Colormap):
303-
returncmap
304-
cmap_name=mpl._val_or_rc(cmap,"image.cmap")
305-
# use check_in_list to ensure type stability of the exception raised by
306-
# the internal usage of this (ValueError vs KeyError)
307-
ifcmap_namenotin_colormaps:
308-
_api.check_in_list(sorted(_colormaps),cmap=cmap_name)
309-
returnmpl.colormaps[cmap_name]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp