From: <ef...@us...> - 2008-10-04 08:22:04
|
Revision: 6145 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6145&view=rev Author: efiring Date: 2008-10-04 07:16:10 +0000 (Sat, 04 Oct 2008) Log Message: ----------- Change default precision kwarg in spy from None to 0. Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2008-10-02 15:00:54 UTC (rev 6144) +++ trunk/matplotlib/API_CHANGES 2008-10-04 07:16:10 UTC (rev 6145) @@ -2,6 +2,11 @@ Changes for 0.98.x ================== +* Changed precision kwarg in spy; default is 0, and the string value + 'present' is used for sparse arrays only to show filled locations. + +* EllipseCollection added. + * Added angles kwarg to quiver for more flexible specification of the arrow angles. Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-10-02 15:00:54 UTC (rev 6144) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-10-04 07:16:10 UTC (rev 6145) @@ -6648,21 +6648,21 @@ return Pxx, freqs, bins, im - def spy(self, Z, precision=None, marker=None, markersize=None, + def spy(self, Z, precision=0, marker=None, markersize=None, aspect='equal', **kwargs): """ call signature:: - spy(Z, precision=None, marker=None, markersize=None, + spy(Z, precision=0, marker=None, markersize=None, aspect='equal', **kwargs) ``spy(Z)`` plots the sparsity pattern of the 2-D array *Z*. - If *precision* is *None*, any non-zero value will be plotted; + If *precision* is 0, any non-zero value will be plotted; else, values of :math:`|Z| > precision` will be plotted. For :class:`scipy.sparse.spmatrix` instances, there is a - special case: if *precision* is 0, any value present in + special case: if *precision* is 'present', any value present in the array will be plotted, even if it is identically zero. The array will be plotted as it would be printed, with @@ -6715,12 +6715,15 @@ * ',' pixel """ + if precision is None: + precision = 0 + warnings.DeprecationWarning("Use precision=0 instead of None") + # 2008/10/03 if marker is None and markersize is None and hasattr(Z, 'tocoo'): marker = 's' if marker is None and markersize is None: Z = np.asarray(Z) - if precision is None: mask = Z!=0. - else: mask = np.absolute(Z)>precision + mask = np.absolute(Z)>precision if 'cmap' not in kwargs: kwargs['cmap'] = mcolors.ListedColormap(['w', 'k'], name='binary') @@ -6731,22 +6734,16 @@ else: if hasattr(Z, 'tocoo'): c = Z.tocoo() - if precision == 0: + if precision == 'present': y = c.row x = c.col else: - if precision is None: - nonzero = c.data != 0. - else: - nonzero = np.absolute(c.data) > precision + nonzero = np.absolute(c.data) > precision y = c.row[nonzero] x = c.col[nonzero] else: Z = np.asarray(Z) - if precision is None: - nonzero = Z!=0. - else: - nonzero = np.absolute(Z)>precision + nonzero = np.absolute(Z)>precision y, x = np.nonzero(nonzero) if marker is None: marker = 's' if markersize is None: markersize = 10 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |