Skip to content

Commit 0578190

Browse files
committed
added hold kwarg to plot commands
svn path=/trunk/matplotlib/; revision=774
1 parent 413cc96 commit 0578190

File tree

2 files changed

+141
-75
lines changed

2 files changed

+141
-75
lines changed

boilerplate.py

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
# file is pasted into pylab.py
33

44

5-
__fmt = """\
6-
7-
# this function was autogenerated by boilerplate.py. Do not edit as
5+
_fmtplot = """\
6+
# This function was autogenerated by boilerplate.py. Do not edit as
87
# changes will be lost
98
def %(func)s(*args, **kwargs):
109
# allow callers to override the hold state by passing hold=True|False
@@ -27,10 +26,24 @@ def %(func)s(*args, **kwargs):
2726
Addition kwargs: hold = [True|False] overrides default hold state\"\"\"
2827
"""
2928

29+
_fmtmisc = """\
30+
# This function was autogenerated by boilerplate.py. Do not edit as
31+
# changes will be lost
32+
def %(func)s(*args, **kwargs):
33+
try:
34+
ret = gca().%(func)s(*args, **kwargs)
35+
except ValueError, msg:
36+
msg = raise_msg_to_str(msg)
37+
error_msg(msg)
38+
else:
39+
draw_if_interactive()
40+
return ret
41+
%(func)s.__doc__ = Axes.%(func)s.__doc__
42+
"""
3043

3144
# these methods are all simple wrappers of Axes methods by the same
3245
# name.
33-
_methods = (
46+
_plotcommands = (
3447
'axhline',
3548
'axhspan',
3649
'axvline',
@@ -67,6 +80,14 @@ def %(func)s(*args, **kwargs):
6780
'vlines',
6881
)
6982

83+
_misccommands = (
84+
'cla',
85+
'grid',
86+
'legend',
87+
'table',
88+
'text',
89+
)
90+
7091
cmappable = {
7192
'scatter' : 'gci._current = ret',
7293
'pcolor' : 'gci._current = ret',
@@ -76,9 +97,13 @@ def %(func)s(*args, **kwargs):
7697
}
7798

7899

79-
for func in _methods:
100+
for func in _plotcommands:
80101
if cmappable.has_key(func):
81102
mappable = cmappable[func]
82103
else:
83104
mappable = ''
84-
print __fmt%locals()
105+
print _fmtplot%locals()
106+
107+
108+
for func in _misccommands:
109+
print _fmtmisc%locals()

0 commit comments

Comments
 (0)