| |
- __builtin__.object
-
- Artist
- ArtistInspector
class Artist(__builtin__.object) |
|
Abstract base class for someone who renders into a
:class:`FigureCanvas`. |
|
Methods defined here:
- __init__(self)
- add_callback(self, func)
- contains(self, mouseevent)
- Test whether the artist contains the mouse event.
Returns the truth value and a dictionary of artist specific details of
selection, such as which points are contained in the pick radius. See
individual artists for details.
- convert_xunits(self, x)
- for artists in an axes, if the xaxis as units support,
convert *x* using xaxis unit type
- convert_yunits(self, y)
- for artists in an axes, if the yaxis as units support,
convert *y* using yaxis unit type
- draw(self, renderer, *args, **kwargs)
- Derived classes drawing method
- findobj(self, match=None)
- pyplot signature:
findobj(o=gcf(), match=None)
recursively find all :class:matplotlib.artist.Artist instances
contained in self
*match* can be
- None: return all objects contained in artist (including artist)
- function with signature ``boolean = match(artist)`` used to filter matches
- class instance: eg Line2D. Only return artists of class type
.. plot:: ../mpl_examples/pylab_examples/findobj_demo.py
- get_alpha(self)
- Return the alpha value used for blending - not supported on all
backends
- get_animated(self)
- return the artist's animated state
- get_axes(self)
- return the axes instance the artist resides in, or *None*
- get_clip_box(self)
- Return artist clipbox
- get_clip_on(self)
- Return whether artist uses clipping
- get_clip_path(self)
- Return artist clip path
- get_contains(self)
- return the _contains test used by the artist, or *None* for default.
- get_figure(self)
- Return the :class:`~matplotlib.figure.Figure` instance the
artist belongs to.
- get_label(self)
- get_picker(self)
- return the Pickeration instance used by this artist
- get_transform(self)
- Return the :class:`~matplotlib.transforms.Transform`
instance used by this artist.
- get_transformed_clip_path_and_affine(self)
- Return the clip path with the non-affine part of its
transformation applied, and the remaining affine part of its
transformation.
- get_visible(self)
- return the artist's visiblity
- get_zorder(self)
- have_units(self)
- return *True* if units are set on the x or y axes
- hitlist(self, event)
- List the children of the artist which contain the mouse event
- is_figure_set(self)
- is_transform_set(self)
- Artist has transform explicity let
- pchanged(self)
- fire event when property changed
- pick(self, mouseevent)
- call signature::
pick(mouseevent)
each child artist will fire a pick event if *mouseevent* is over
the artist and the artist has picker set
- pickable(self)
- return *True* if self is pickable
- remove(self)
- Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
:meth:`matplotlib.axes.Axes.draw_idle`. Call
:meth:`matplotlib.axes.Axes.relim` to update the axes limits
if desired.
Note: :meth:`~matplotlib.axes.Axes.relim` will not see
collections even if the collection was added to axes with
*autolim* = True.
Note: there is no support for removing the artist's legend entry.
- remove_callback(self, oid)
- set(self, **kwargs)
- A tkstyle set command, pass *kwargs* to set properties
- set_alpha(self, alpha)
- Set the alpha value used for blending - not supported on
all backends
ACCEPTS: float
- set_animated(self, b)
- set the artist's animation state
ACCEPTS: [True | False]
- set_axes(self, axes)
- set the axes instance in which the artist resides, if any
ACCEPTS: an axes instance
- set_clip_box(self, clipbox)
- Set the artist's clip Bbox
ACCEPTS: a :class:`matplotlib.transform.Bbox` instance
- set_clip_on(self, b)
- Set whether artist uses clipping
ACCEPTS: [True | False]
- set_clip_path(self, path, transform=None)
- Set the artist's clip path, which may be:
* a :class:`~matplotlib.patches.Patch` (or subclass) instance
* a :class:`~matplotlib.path.Path` instance, in which case
an optional :class:`~matplotlib.transforms.Transform`
instance may be provided, which will be applied to the
path before using it for clipping.
* *None*, to remove the clipping path
For efficiency, if the path happens to be an axis-aligned
rectangle, this method will set the clipping box to the
corresponding rectangle and set the clipping path to *None*.
ACCEPTS: a :class:`~matplotlib.path.Path` instance and a
:class:`~matplotlib.transforms.Transform` instance, a
:class:`~matplotlib.patches.Patch` instance, or *None*.
- set_contains(self, picker)
- Replace the contains test used by this artist. The new picker should
be a callable function which determines whether the artist is hit by the
mouse event::
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return *hit=True* and *props*
is a dictionary of properties you want returned with the contains test.
- set_figure(self, fig)
- Set the :class:`~matplotlib.figure.Figure` instance the artist
belongs to.
ACCEPTS: a :class:`matplotlib.figure.Figure` instance
- set_label(self, s)
- Set the line label to *s* for auto legend
ACCEPTS: any string
- set_lod(self, on)
- Set Level of Detail on or off. If on, the artists may examine
things like the pixel width of the axes and draw a subset of
their contents accordingly
ACCEPTS: [True | False]
- set_picker(self, picker)
- set the epsilon for picking used by this artist
*picker* can be one of the following:
* *None*: picking is disabled for this artist (default)
* A boolean: if *True* then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist
* A float: if picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if it's data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g. the indices of the data within
epsilon of the pick event
* A function: if picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event::
hit, props = picker(artist, mouseevent)
to determine the hit test. if the mouse event is over the
artist, return *hit=True* and props is a dictionary of
properties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
- set_transform(self, t)
- Set the :class:`~matplotlib.transforms.Transform` instance
used by this artist.
- set_visible(self, b)
- set the artist's visiblity
ACCEPTS: [True | False]
- set_zorder(self, level)
- Set the zorder for the artist
ACCEPTS: any number
- update(self, props)
- update_from(self, other)
- Copy properties from *other* to *self*.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- aname = 'Artist'
- zorder = 0
|
class ArtistInspector |
|
A helper class to inspect an :class:`~matplotlib.artist.Artist`
and return information about it's settable properties and their
current values. |
|
Methods defined here:
- __init__(self, o)
- Initialize the artist inspector with an
:class:`~matplotlib.artist.Artist` or sequence of
:class:`Artists`. If a sequence is used, we assume it is a
homogeneous sequence (all :class:`Artists` are of the same
type) and it is your responsibility to make sure this is so.
- aliased_name(self, s)
- 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'
- findobj(self, match=None)
- recursively find all :class:matplotlib.artist.Artist instances
contained in self
if *match* is not None, it can be
- function with signature ``boolean = match(artist)``
- class instance: eg Line2D
used to filter matches
- get_aliases(self)
- Get a dict mapping *fullname* -> *alias* for each *alias* in
the :class:`~matplotlib.artist.ArtistInspector`.
Eg., for lines::
{'markerfacecolor': 'mfc',
'linewidth' : 'lw',
}
- get_setters(self)
- Get the attribute strings with setters for object. Eg., for a line,
return ``['markerfacecolor', 'linewidth', ....]``.
- get_valid_values(self, attr)
- Get the legal arguments for the setter associated with *attr*.
This is done by querying the docstring of the function *set_attr*
for a line that begins with ACCEPTS:
Eg., for a line linestyle, return
[ '-' | '--' | '-.' | ':' | 'steps' | 'None' ]
- is_alias(self, o)
- Return *True* if method object *o* is an alias for another
function.
- pprint_getters(self)
- Return the getters and actual values as list of strings.
- pprint_setters(self, prop=None, leadingspace=2)
- If *prop* is *None*, return a list of strings of all settable properies
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.
| |