matplotlib._docstring
#
- classmatplotlib._docstring.Substitution(*args,**kwargs)[source]#
Bases:
object
A decorator that performs %-substitution on an object's docstring.
This decorator should be robust even if
obj.__doc__
is None (forexample, if -OO was passed to the interpreter).Usage: construct a docstring.Substitution with a sequence or dictionarysuitable for performing substitution; then decorate a suitable functionwith the constructed object, e.g.:
sub_author_name=Substitution(author='Jason')@sub_author_namedefsome_function(x):"%(author)s wrote this function"# note that some_function.__doc__ is now "Jason wrote this function"
One can also use positional arguments:
sub_first_last_names=Substitution('Edgar Allen','Poe')@sub_first_last_namesdefsome_function(x):"%s%s wrote the Raven"
- matplotlib._docstring.copy(source)[source]#
Copy a docstring from another source function (if present).
- matplotlib._docstring.kwarg_doc(text)[source]#
Decorator for defining the kwdoc documentation of artist properties.
This decorator can be applied to artist property setter methods.The given text is stored in a private attribute
_kwarg_doc
onthe method. It is used to overwrite auto-generated documentationin thekwdoc list for artists. The kwdoc list is used to document**kwargs
when they are properties of an artist. See e.g. the**kwargs
section inAxes.text
.The text should contain the supported types, as well as the defaultvalue if applicable, e.g.:
@_docstring.kwarg_doc("bool, default:
rcParams["text.usetex"]
(default:False
)")def set_usetex(self, usetex):See also