SF.net SVN: matplotlib:[7023] trunk/matplotlib
Revision: 7023
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7023&view=rev
Author: efiring
Date: 2009-04-04 22:52:53 + (Sat, 04 Apr 2009)
Log Message:
---
Add log scale option to clip non-positive values instead of masking
Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/doc/api/api_changes.rst
trunk/matplotlib/examples/pylab_examples/log_demo.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/scale.py
Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG 2009-04-01 20:44:58 UTC (rev 7022)
+++ trunk/matplotlib/CHANGELOG 2009-04-04 22:52:53 UTC (rev 7023)
@@ -1,3 +1,6 @@
+2009-04-04 Allow log axis scale to clip non-positive values to
+ small positive value; this is useful for errorbars. - EF
+
2009-03-28 Make images handle nan in their array argument.
A helper, cbook.safe_masked_invalid() was added. - EF
Modified: trunk/matplotlib/doc/api/api_changes.rst
===
--- trunk/matplotlib/doc/api/api_changes.rst2009-04-01 20:44:58 UTC (rev
7022)
+++ trunk/matplotlib/doc/api/api_changes.rst2009-04-04 22:52:53 UTC (rev
7023)
@@ -19,6 +19,12 @@
Changes for 0.98.x
==
+* Added new keyword parameters *nonposx*, *nonposy* to
+ :class:`matplotlib.axes.Axes` methods that set log scale
+ parameters. The default is still to mask out non-positive
+ values, but the kwargs accept 'clip', which causes non-positive
+ values to be replaced with a very small positive value.
+
* Added new :func:`matplotlib.pyplot.fignum_exists` and
:func:`matplotlib.pyplot.get_fignums`; they merely expose
information that had been hidden in :mod:`matplotlib._pylab_helpers`.
Modified: trunk/matplotlib/examples/pylab_examples/log_demo.py
===
--- trunk/matplotlib/examples/pylab_examples/log_demo.py2009-04-01
20:44:58 UTC (rev 7022)
+++ trunk/matplotlib/examples/pylab_examples/log_demo.py2009-04-04
22:52:53 UTC (rev 7023)
@@ -6,21 +6,33 @@
t = np.arange(0.01, 20.0, 0.01)
# log y axis
-plt.subplot(311)
+plt.subplot(221)
plt.semilogy(t, np.exp(-t/5.0))
-plt.ylabel('semilogy')
+plt.title('semilogy')
plt.grid(True)
# log x axis
-plt.subplot(312)
+plt.subplot(222)
plt.semilogx(t, np.sin(2*np.pi*t))
-plt.ylabel('semilogx')
+plt.title('semilogx')
plt.grid(True)
# log x and y axis
-plt.subplot(313)
+plt.subplot(223)
plt.loglog(t, 20*np.exp(-t/10.0), basex=4)
plt.grid(True)
-plt.ylabel('loglog base 4 on x')
+plt.title('loglog base 4 on x')
+# with errorbars: clip non-positive values
+ax = plt.subplot(224)
+ax.set_xscale("log", nonposx='clip')
+ax.set_yscale("log", nonposy='clip')
+
+x = 10.0**np.linspace(0.0, 2.0, 20)
+y = x**2.0
+plt.errorbar(x, y, xerr=0.1*x, yerr=5.0+0.75*y)
+ax.set_ylim(ymin=0.1)
+ax.set_title('Errorbars go negative')
+
+
plt.show()
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-04-01 20:44:58 UTC (rev
7022)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-04-04 22:52:53 UTC (rev
7023)
@@ -3455,6 +3455,10 @@
plot; see :meth:`matplotlib.axes.Axes.set_xscale` /
:meth:`matplotlib.axes.Axes.set_yscale` for details
+ *nonposx*/*nonposy*: ['mask' | 'clip' ]
+non-positive values in *x* or *y* can be masked as
+invalid, or clipped to a very small positive number
+
The remaining valid kwargs are
:class:`~matplotlib.lines.Line2D` properties:
@@ -3469,9 +3473,11 @@
dx = {'basex': kwargs.pop('basex', 10),
'subsx': kwargs.pop('subsx', None),
+ 'nonposx': kwargs.pop('nonposx', 'mask'),
}
dy = {'basey': kwargs.pop('basey', 10),
'subsy': kwargs.pop('subsy', None),
+ 'nonposy': kwargs.pop('nonposy', 'mask'),
}
self.set_xscale('log', **dx)
@@ -3508,6 +3514,10 @@
plot; see :meth:`~matplotlib.axes.Axes.set_xscale` for
details.
+ *nonposx*: ['mask' | 'clip' ]
+non-positive values in *x* can be masked as
+invalid, or clipped to a very small positive number
+
The remaining valid kwargs are
:class:`~matplotlib.lines.Line2D` properties:
@@ -3521,6 +3531,7 @@
if not self._hold: self.cla()
d = {'basex': kwargs.pop( 'basex', 10),
'subsx': kwargs.pop( 'subsx', None),
+ 'nonposx': kwargs.pop('nonposx', 'mask'),
}
self.set_xscale('log', **d)
@@ -3554,6 +3565,10 @@
plot; see :meth:`~matplotlib.axes.Axes.set_yscale` for
details.
+ *nonposy*: ['mask' |
SF.net SVN: matplotlib:[7025] branches/v0_98_5_maint/lib/matplotlib/colors. py
Revision: 7025 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7025&view=rev Author: efiring Date: 2009-04-05 02:16:44 + (Sun, 05 Apr 2009) Log Message: --- Fix PatchCollection bug 2732455 by letting to_rgba handle 'none' Modified Paths: -- branches/v0_98_5_maint/lib/matplotlib/colors.py Modified: branches/v0_98_5_maint/lib/matplotlib/colors.py === --- branches/v0_98_5_maint/lib/matplotlib/colors.py 2009-04-05 01:37:26 UTC (rev 7024) +++ branches/v0_98_5_maint/lib/matplotlib/colors.py 2009-04-05 02:16:44 UTC (rev 7025) @@ -318,10 +318,18 @@ Returns an *RGBA* tuple of four floats from 0-1. For acceptable values of *arg*, see :meth:`to_rgb`. +In addition, if *arg* is "none" (case-insensitive), +then (0,0,0,0) will be returned. If *arg* is an *RGBA* sequence and *alpha* is not *None*, *alpha* will replace the original *A*. """ try: +if arg.lower() == 'none': +return (0.0, 0.0, 0.0, 0.0) +except AttributeError: +pass + +try: if not cbook.is_string_like(arg) and cbook.iterable(arg): if len(arg) == 4: if [x for x in arg if (float(x) < 0) or (x > 1)]: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[7024] branches/v0_98_5_maint/lib/matplotlib/ collections.py
Revision: 7024 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7024&view=rev Author: efiring Date: 2009-04-05 01:37:26 + (Sun, 05 Apr 2009) Log Message: --- Fix PatchCollection bug 2723527; thanks to Thomas Robitaille Modified Paths: -- branches/v0_98_5_maint/lib/matplotlib/collections.py Modified: branches/v0_98_5_maint/lib/matplotlib/collections.py === --- branches/v0_98_5_maint/lib/matplotlib/collections.py2009-04-04 22:52:53 UTC (rev 7023) +++ branches/v0_98_5_maint/lib/matplotlib/collections.py2009-04-05 01:37:26 UTC (rev 7024) @@ -1108,7 +1108,7 @@ facecolors = [determine_facecolor(p) for p in patches] edgecolors = [p.get_edgecolor() for p in patches] -linewidths = [p.get_linewidths() for p in patches] +linewidths = [p.get_linewidth() for p in patches] antialiaseds = [p.get_antialiased() for p in patches] Collection.__init__( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[7026] trunk/matplotlib
Revision: 7026 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7026&view=rev Author: efiring Date: 2009-04-05 02:23:03 + (Sun, 05 Apr 2009) Log Message: --- Merged revisions 7024-7025 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint r7024 | efiring | 2009-04-04 15:37:26 -1000 (Sat, 04 Apr 2009) | 2 lines Fix PatchCollection bug 2723527; thanks to Thomas Robitaille r7025 | efiring | 2009-04-04 16:16:44 -1000 (Sat, 04 Apr 2009) | 2 lines Fix PatchCollection bug 2732455 by letting to_rgba handle 'none' Modified Paths: -- trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/colors.py Property Changed: trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7018 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7025 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025 Property changes on: trunk/matplotlib/doc/pyplots/README ___ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6
