Dear list,
There is a bug in stem, demonstrated by:
from matplotlib.pylab import *
stem(arange(10),arange(10),hold=False)
show()
A simple fix is below; it simply sets hold to True for the duration of
the stem method, and restores the hold state once done.
This was tested with the very simple
plot(arange(10)); stem(arange(10),arange(10),hold=True); show()
and
plot(arange(10)); stem(arange(10),arange(10),hold=False); show()
Regards,
Rory
Index: axes.py
···
===================================================================
--- axes.py (revision 2406)
+++ axes.py (working copy)
@@ -2509,7 +2509,10 @@
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/stem.html
for details and examples/stem_plot.py for a demo.
"""
+ remember_hold=self._hold
if not self._hold: self.cla()
+ self.hold(True)
+
markerline, = self.plot(x, y, markerfmt)
stemlines = []
@@ -2518,6 +2521,9 @@
stemlines.append(l)
baseline, = self.plot([amin(x), amax(x)], [0,0], basefmt)
+
+ self.hold(remember_hold)
+
return markerline, stemlines, baseline