matplotlib.artist.ArtistInspector

class matplotlib.artist.ArtistInspector(o)[source]

A helper class to inspect an Artist and return information about its settable properties and their current values.

Initialize the artist inspector with an Artist or an iterable of Artists. If an iterable is used, we assume it is a homogeneous sequence (all Artists are of the same type) and it is your responsibility to make sure this is so.

__init__(o)[source]

Initialize the artist inspector with an Artist or an iterable of Artists. If an iterable is used, we assume it is a homogeneous sequence (all Artists are of the same type) and it is your responsibility to make sure this is so.

Methods

__init__(o) Initialize the artist inspector with an Artist or an iterable of Artists.
aliased_name(s) Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME'.
aliased_name_rest(s, target) Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME', formatted for reST.
get_aliases() Get a dict mapping property fullnames to sets of aliases for each alias in the ArtistInspector.
get_setters() Get the attribute strings with setters for object.
get_valid_values(attr) Get the legal arguments for the setter associated with attr.
is_alias(o) Return whether method object o is an alias for another method.
pprint_getters() Return the getters and actual values as list of strings.
pprint_setters([prop, leadingspace]) If prop is None, return a list of strings of all settable properties and their valid values.
pprint_setters_rest([prop, leadingspace]) If prop is None, return a list of reST-formatted strings of all settable properties and their valid values.
properties() Return a dictionary mapping property name -> value.
aliased_name(s)[source]

Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME'.

e.g., for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'.

aliased_name_rest(s, target)[source]

Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME', formatted for reST.

e.g., for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'.

get_aliases()[source]

Get a dict mapping property fullnames to sets of aliases for each alias in the ArtistInspector.

e.g., for lines:

{'markerfacecolor': {'mfc'},
 'linewidth'      : {'lw'},
}
get_setters()[source]

Get the attribute strings with setters for object.

For example, for a line, return ['markerfacecolor', 'linewidth', ....].

get_valid_values(attr)[source]

Get the legal arguments for the setter associated with attr.

This is done by querying the docstring of the setter for a line that begins with "ACCEPTS:" or ".. ACCEPTS:", and then by looking for a numpydoc-style documentation for the setter's first argument.

is_alias(o)[source]

Return whether method object o is an alias for another method.

pprint_getters()[source]

Return the getters and actual values as list of strings.

pprint_setters(prop=None, leadingspace=2)[source]

If prop is None, return a list of strings of all settable properties and their valid values.

If prop is not None, it is a valid property name and that property will be returned as a string of property : valid values.

pprint_setters_rest(prop=None, leadingspace=4)[source]

If prop is None, return a list of reST-formatted strings of all settable properties and their valid values.

If prop is not None, it is a valid property name and that property will be returned as a string of "property : valid" values.

properties()[source]

Return a dictionary mapping property name -> value.