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

Commit3101e00

Browse files
committed
LogNorm.autoscale ignores nonpositive values; closes 2953069
svn path=/trunk/matplotlib/; revision=8348
1 parent9226ef5 commit3101e00

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎lib/matplotlib/colors.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,8 @@ def __call__(self, value, clip=None):
850850
vtype='scalar'
851851
val=ma.array([value]).astype(np.float)
852852

853+
val=ma.masked_less_equal(val,0,copy=False)
854+
853855
self.autoscale_None(val)
854856
vmin,vmax=self.vmin,self.vmax
855857
ifvmin>vmax:
@@ -879,6 +881,24 @@ def inverse(self, value):
879881
else:
880882
returnvmin*pow((vmax/vmin),value)
881883

884+
defautoscale(self,A):
885+
'''
886+
Set *vmin*, *vmax* to min, max of *A*.
887+
'''
888+
A=ma.masked_less_equal(A,0,copy=False)
889+
self.vmin=ma.min(A)
890+
self.vmax=ma.max(A)
891+
892+
defautoscale_None(self,A):
893+
' autoscale only None-valued vmin or vmax'
894+
ifself.vminisnotNoneandself.vmaxisnotNone:
895+
return
896+
A=ma.masked_less_equal(A,0,copy=False)
897+
ifself.vminisNone:
898+
self.vmin=ma.min(A)
899+
ifself.vmaxisNone:
900+
self.vmax=ma.max(A)
901+
882902
classBoundaryNorm(Normalize):
883903
'''
884904
Generate a colormap index based on discrete intervals.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp