Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6baa03e

Browse files
committed
Merged revisions 8722-8725 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint ........ r8722 | efiring | 2010-09-27 08:51:05 -1000 (Mon, 27 Sep 2010) | 2 lines Clarify docstrings for autoscale_view and relim. ........ r8723 | efiring | 2010-10-03 10:45:38 -1000 (Sun, 03 Oct 2010) | 2 lines docs: in event_handling, note that weak references to callbacks are used. ........ r8724 | efiring | 2010-10-03 11:04:10 -1000 (Sun, 03 Oct 2010) | 2 lines errorbar bugfix: plot everything regardless of the Axes hold state ........ r8725 | efiring | 2010-10-03 11:17:39 -1000 (Sun, 03 Oct 2010) | 2 lines bugfix: applied patch by Stan West to fix error in colormap reversal ........ svn path=/trunk/matplotlib/; revision=8726
1 parent dee0f95 commit 6baa03e

5 files changed

Lines changed: 27 additions & 5 deletions

File tree

doc/pyplots/tex_demo.png

7.16 KB
Loading

doc/users/event_handling.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ disconnect the callback, just call::
4646

4747
fig.canvas.mpl_disconnect(cid)
4848

49+
.. note::
50+
The canvas retains only weak references to the callbacks. Therefore
51+
if a callback is a method of a class instance, you need to retain
52+
a reference to that instance. Otherwise the instance will be
53+
garbage-collected and the callback will vanish.
54+
55+
4956
Here are the events that you can connect to, the class instances that
5057
are sent back to you when the event occurs, and the event descriptions
5158

lib/matplotlib/_cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ def gfunc32(x):
15541554
(0.000, 0.000, 0.000), (0.0547, 1.000, 1.000),
15551555
(0.250, 0.027, 0.250), #(0.2500, 0.250, 0.250),
15561556
(1.000, 1.000, 1.000)),
1557-
'green': ((0, 0, 0), (1, 1, 0)),
1557+
'green': ((0, 0, 0), (1, 1, 1)),
15581558
'blue': (
15591559
(0.000, 0.000, 0.000), (0.500, 1.000, 1.000),
15601560
(0.735, 0.000, 0.000), (1.000, 1.000, 1.000))

lib/matplotlib/axes.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,12 @@ def add_table(self, tab):
14951495
return tab
14961496

14971497
def relim(self):
1498-
'recompute the data limits based on current artists'
1498+
"""
1499+
Recompute the data limits based on current artists.
1500+
1501+
At present, :class:`~matplotlib.collections.Collection`
1502+
instances are not supported.
1503+
"""
14991504
# Collections are deliberately not supported (yet); see
15001505
# the TODO note in artists.py.
15011506
self.dataLim.ignore(True)
@@ -1768,10 +1773,16 @@ def autoscale(self, enable=True, axis='both', tight=None):
17681773

17691774
def autoscale_view(self, tight=None, scalex=True, scaley=True):
17701775
"""
1771-
autoscale the view limits using the data limits. You can
1776+
Autoscale the view limits using the data limits. You can
17721777
selectively autoscale only a single axis, eg, the xaxis by
17731778
setting *scaley* to *False*. The autoscaling preserves any
17741779
axis direction reversal that has already been done.
1780+
1781+
The data limits are not updated automatically when artist
1782+
data are changed after the artist has been added to an
1783+
Axes instance. In that case, use
1784+
:meth:`matplotlib.axes.Axes.relim`
1785+
prior to calling autoscale_view.
17751786
"""
17761787
if tight is not None:
17771788
self._tight = bool(tight)
@@ -5060,7 +5071,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
50605071
type as *xerr* and *yerr*.
50615072
50625073
All other keyword arguments are passed on to the plot command for the
5063-
markers, For example, this code makes big red squares with
5074+
markers. For example, this code makes big red squares with
50645075
thick green edges::
50655076
50665077
x,y,yerr = rand(3,10)
@@ -5094,6 +5105,8 @@ def errorbar(self, x, y, yerr=None, xerr=None,
50945105

50955106
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
50965107
if not self._hold: self.cla()
5108+
holdstate = self._hold
5109+
self._hold = True
50975110

50985111
# make sure all the args are iterable; use lists not arrays to
50995112
# preserve units
@@ -5266,6 +5279,7 @@ def xywhere(xs, ys, mask):
52665279
l.set_color(ecolor)
52675280

52685281
self.autoscale_view()
5282+
self._hold = holdstate
52695283
return (l0, caplines, barcols)
52705284

52715285
def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,

lib/matplotlib/cm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def revcmap(data):
3434
# each time, so the colors are identical
3535
# and the result is shades of gray.
3636
else:
37-
valnew = [(1.0 - a, b, c) for a, b, c in reversed(val)]
37+
# Flip x and exchange the y values facing x = 0 and x = 1.
38+
valnew = [(1.0 - x, y1, y0) for x, y0, y1 in reversed(val)]
3839
data_r[key] = valnew
3940
return data_r
4041

0 commit comments

Comments
 (0)