SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <md...@us...> - 2010年10月12日 19:13:15
Revision: 8749
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8749&view=rev
Author: mdboom
Date: 2010年10月12日 19:13:09 +0000 (2010年10月12日)
Log Message:
-----------
Safer handling of the minimum positive value in log locators.
Modified Paths:
--------------
 branches/v1_0_maint/lib/matplotlib/ticker.py
Modified: branches/v1_0_maint/lib/matplotlib/ticker.py
===================================================================
--- branches/v1_0_maint/lib/matplotlib/ticker.py	2010年10月12日 17:23:36 UTC (rev 8748)
+++ branches/v1_0_maint/lib/matplotlib/ticker.py	2010年10月12日 19:13:09 UTC (rev 8749)
@@ -1244,7 +1244,7 @@
 
 if vmin <= 0.0:
 vmin = self.axis.get_minpos()
- if vmin <= 0.0:
+ if vmin <= 0.0 or not np.isfinite(vmin):
 raise ValueError(
 "Data has no positive values, and therefore can not be log-scaled.")
 
@@ -1292,7 +1292,7 @@
 
 minpos = self.axis.get_minpos()
 
- if minpos<=0:
+ if minpos<=0 or not np.isfinite(minpos):
 raise ValueError(
 "Data has no positive values, and therefore can not be log-scaled.")
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年10月13日 18:02:05
Revision: 8752
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8752&view=rev
Author: mdboom
Date: 2010年10月13日 18:01:59 +0000 (2010年10月13日)
Log Message:
-----------
Fix is_decade()
Modified Paths:
--------------
 branches/v1_0_maint/lib/matplotlib/ticker.py
Modified: branches/v1_0_maint/lib/matplotlib/ticker.py
===================================================================
--- branches/v1_0_maint/lib/matplotlib/ticker.py	2010年10月13日 15:45:14 UTC (rev 8751)
+++ branches/v1_0_maint/lib/matplotlib/ticker.py	2010年10月13日 18:01:59 UTC (rev 8752)
@@ -546,7 +546,7 @@
 sign = np.sign(x)
 # only label the decades
 fx = math.log(abs(x))/math.log(b)
- isDecade = self.is_decade(fx)
+ isDecade = is_decade(fx)
 if not isDecade and self.labelOnlyBase: s = ''
 elif x>10000: s= '%1.0e'%x
 elif x<1: s = '%1.0e'%x
@@ -567,15 +567,6 @@
 'return a short formatted string representation of a number'
 return '%-12g'%value
 
- def is_decade(self, x):
- n = self.nearest_long(x)
- return abs(x-n)<1e-10
-
- def nearest_long(self, x):
- if x == 0: return 0L
- elif x > 0: return long(x+0.5)
- else: return long(x-0.5)
-
 def pprint_val(self, x, d):
 #if the number is not too big and it's an int, format it as an
 #int
@@ -617,7 +608,7 @@
 sign = np.sign(x)
 # only label the decades
 fx = math.log(abs(x))/math.log(b)
- isDecade = self.is_decade(fx)
+ isDecade = is_decade(fx)
 if not isDecade and self.labelOnlyBase: s = ''
 #if 0: pass
 elif fx>10000: s= '%1.0e'%fx
@@ -644,7 +635,7 @@
 return '0ドル$'
 sign = np.sign(x)
 fx = math.log(abs(x))/math.log(b)
- isDecade = self.is_decade(fx)
+ isDecade = is_decade(fx)
 
 usetex = rcParams['text.usetex']
 
@@ -661,10 +652,10 @@
 s = '$\mathdefault{%s%d^{%.2f}}$'% (sign_string, b, fx)
 else:
 if usetex:
- s = r'$%s%d^{%d}$'% (sign_string, b, self.nearest_long(fx))
+ s = r'$%s%d^{%d}$'% (sign_string, b, nearest_long(fx))
 else:
 s = r'$\mathdefault{%s%d^{%d}}$'% (sign_string, b,
- self.nearest_long(fx))
+ nearest_long(fx))
 
 return s
 
@@ -1190,11 +1181,16 @@
 lx = math.ceil(math.log(x)/math.log(base))
 return base**lx
 
-def is_decade(x,base=10):
+def nearest_long(x):
+ if x == 0: return 0L
+ elif x > 0: return long(x+0.5)
+ else: return long(x-0.5)
+
+def is_decade(x, base=10):
 if x == 0.0:
 return True
 lx = math.log(x)/math.log(base)
- return lx==int(lx)
+ return abs(lx - nearest_long(lx)) < 1e-10
 
 class LogLocator(Locator):
 """
@@ -1212,7 +1208,7 @@
 
 def base(self,base):
 """
- set the base of the log scaling (major tick every base**i, i interger)
+ set the base of the log scaling (major tick every base**i, i integer)
 """
 self._base=base+0.0
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年10月19日 12:44:20
Revision: 8755
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8755&view=rev
Author: mdboom
Date: 2010年10月19日 12:44:14 +0000 (2010年10月19日)
Log Message:
-----------
Make is_decade safe for non-finite values.
Modified Paths:
--------------
 branches/v1_0_maint/lib/matplotlib/ticker.py
Modified: branches/v1_0_maint/lib/matplotlib/ticker.py
===================================================================
--- branches/v1_0_maint/lib/matplotlib/ticker.py	2010年10月15日 13:34:49 UTC (rev 8754)
+++ branches/v1_0_maint/lib/matplotlib/ticker.py	2010年10月19日 12:44:14 UTC (rev 8755)
@@ -1187,6 +1187,8 @@
 else: return long(x-0.5)
 
 def is_decade(x, base=10):
+y if not np.isfinite(x):
+ return False
 if x == 0.0:
 return True
 lx = math.log(x)/math.log(base)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <wea...@us...> - 2011年01月05日 17:44:26
Revision: 8891
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8891&view=rev
Author: weathergod
Date: 2011年01月05日 17:44:17 +0000 (2011年1月05日)
Log Message:
-----------
Applying a similar fix to r8873 which seemed to only have been applied to the development branch.
This fixes a math domain error when using log scales.
Modified Paths:
--------------
 branches/v1_0_maint/lib/matplotlib/ticker.py
Modified: branches/v1_0_maint/lib/matplotlib/ticker.py
===================================================================
--- branches/v1_0_maint/lib/matplotlib/ticker.py	2011年01月05日 16:29:53 UTC (rev 8890)
+++ branches/v1_0_maint/lib/matplotlib/ticker.py	2011年01月05日 17:44:17 UTC (rev 8891)
@@ -1194,7 +1194,7 @@
 return False
 if x == 0.0:
 return True
- lx = math.log(x)/math.log(base)
+ lx = math.log(abs(x))/math.log(base)
 return is_close_to_int(lx)
 
 def is_close_to_int(x):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /