2
2
# file is pasted into pylab.py
3
3
4
4
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
8
7
# changes will be lost
9
8
def %(func)s(*args, **kwargs):
10
9
# allow callers to override the hold state by passing hold=True|False
@@ -27,10 +26,24 @@ def %(func)s(*args, **kwargs):
27
26
Addition kwargs: hold = [True|False] overrides default hold state\" \" \"
28
27
"""
29
28
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
+ """
30
43
31
44
# these methods are all simple wrappers of Axes methods by the same
32
45
# name.
33
- _methods = (
46
+ _plotcommands = (
34
47
'axhline' ,
35
48
'axhspan' ,
36
49
'axvline' ,
@@ -67,6 +80,14 @@ def %(func)s(*args, **kwargs):
67
80
'vlines' ,
68
81
)
69
82
83
+ _misccommands = (
84
+ 'cla' ,
85
+ 'grid' ,
86
+ 'legend' ,
87
+ 'table' ,
88
+ 'text' ,
89
+ )
90
+
70
91
cmappable = {
71
92
'scatter' : 'gci._current = ret' ,
72
93
'pcolor' : 'gci._current = ret' ,
@@ -76,9 +97,13 @@ def %(func)s(*args, **kwargs):
76
97
}
77
98
78
99
79
- for func in _methods :
100
+ for func in _plotcommands :
80
101
if cmappable .has_key (func ):
81
102
mappable = cmappable [func ]
82
103
else :
83
104
mappable = ''
84
- print __fmt % locals ()
105
+ print _fmtplot % locals ()
106
+
107
+
108
+ for func in _misccommands :
109
+ print _fmtmisc % locals ()
0 commit comments