File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,33 @@ def inner(*args, **kwargs):
261
261
return inner
262
262
263
263
264
+ def register_func (func ):
265
+ """
266
+ Registers a function to be wrapped and made available in the
267
+ pyplot namespace for convenient interactive command line use.
268
+
269
+ Parameters
270
+ ----------
271
+ func : callable
272
+
273
+ First parameter of function must be an `Axes` object. Will
274
+ be wrapped by `ensure_ax`
275
+
276
+ Returns
277
+ -------
278
+ callable
279
+
280
+ The wrapped function.
281
+ """
282
+ mod = sys .modules [__name__ ]
283
+ f_name = func .__name__
284
+ if hasattr (mod , f_name ):
285
+ raise RuntimeError ("Function already exists with that name" )
286
+ setattr (mod , f_name , ensure_ax (func ))
287
+
288
+ return getattr (mod , f_name )
289
+
290
+
264
291
@docstring .copy_dedent (Artist .findobj )
265
292
def findobj (o = None , match = None , include_self = True ):
266
293
if o is None :
You can’t perform that action at this time.
0 commit comments