rayoptics.mpl.interactivefigure module
- class SelectInfo(artist, info)
Bases:
tuple
- artist
the artist
- info
a dictionary of artist specific details of selection
- class InteractiveFigure(do_draw_frame=False, do_draw_axes=False, oversize_factor=0.05, aspect='equal', view_bbox=None, do_scale_bounds=False, **kwargs)[source]
Bases:
StyledFigure
Base class for domain specific figures with support for input events
The InteractiveFigure class supplies common implementations for:
polyline and polygon 2D graphics
selection support for mpl graphic objects
mouse/touch event handling
interface commands for zooming and panning the display area
- do_draw_frame
if True, draw frame around the figure
- do_draw_axes
if True, draw coordinate axes for the figure
- oversize_factor
what fraction to oversize the view bounding box
- aspect
‘equal’ for 1:1 aspect ratio, ‘auto’ for best ratio
- artist_filter
an (optional) callable applied in find_artists_at_location(), returns True if rejected
- property is_unit_aspect_ratio
- refresh(**kwargs)[source]
Call update_data() followed by plot(), return self.
- Parameters:
kwargs – keyword arguments are passed to update_data
- Returns:
self (class Figure) so scripting envs will auto display results
- update_patches(shapes)[source]
loop over the input shapes, fetching their current geometry and attaching it to the corresponding
Artist
- get_artist_for_handle(handle) SelectInfo [source]
- find_artists_at_location(event) list[SelectInfo] [source]
Returns a list of shapes in zorder at the event location.
- do_shape_action(event, target: SelectInfo, event_key)[source]
Execute the target shape’s action for the event_key.
This is the default function that the do_action callable attribute is initialized to.
- find_artists_and_hilite(event) list[SelectInfo] [source]
identify and hilite artists at the mouse event location
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, canvas=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, constrained_layout=<UNSET>, constrained_layout_pads=<UNSET>, dpi=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, figheight=<UNSET>, figwidth=<UNSET>, frameon=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, layout_engine=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, size_inches=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tight_layout=<UNSET>, transform=<UNSET>, url=<UNSET>, view_bbox=<UNSET>, visible=<UNSET>, zorder=<UNSET>)
Set multiple properties at once.
Supported properties are
- Properties:
agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: scalar or None animated: bool canvas: FigureCanvas clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor: color facecolor: color figheight: float figure: ~matplotlib.figure.Figure figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: {‘constrained’, ‘compressed’, ‘tight’, ‘none’, .LayoutEngine, None} linewidth: number mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform: ~matplotlib.transforms.Transform url: str view_bbox: unknown visible: bool zorder: float
- update_artist_hiliting(hilited_artists, new_artists)[source]
manage artist hiliting in response to mouse event
- class PanAction(**kwargs)[source]
Bases:
object
wrapper class to handle pan action, handing off to Axes
- class ZoomBoxAction(fig, **kwargs)[source]
Bases:
object
handle zoom box action by using a RectangleSelector widget