|
From: <ef...@us...> - 2008-10-16 21:22:04
|
Revision: 6232
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6232&view=rev
Author: efiring
Date: 2008-10-16 21:21:58 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
Make transforms.nonsingular handle inf and nan sensibly.
Without this, trying to plot a line with all data masked would
raise an exception via the autoscaling.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/transforms.py
Modified: trunk/matplotlib/lib/matplotlib/transforms.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/transforms.py 2008-10-16 20:58:07 UTC (rev 6231)
+++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-10-16 21:21:58 UTC (rev 6232)
@@ -2157,7 +2157,7 @@
def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True):
'''
- Ensure the endpoints of a range are not too close together.
+ Ensure the endpoints of a range are finite and not too close together.
"too close" means the interval is smaller than 'tiny' times
the maximum absolute value.
@@ -2165,7 +2165,11 @@
If they are too close, each will be moved by the 'expander'.
If 'increasing' is True and vmin > vmax, they will be swapped,
regardless of whether they are too close.
+
+ If either is inf or -inf or nan, return - expander, expander.
'''
+ if (not np.isfinite(vmin)) or (not np.isfinite(vmax)):
+ return -expander, expander
swapped = False
if vmax < vmin:
vmin, vmax = vmax, vmin
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|