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:
rayoptics.mpl.styledfigure.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
-
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
-
do_shape_action
(event, target, 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.
-
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: .Bbox 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: .Figure figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: unknown linewidth: number mouseover: bool path_effects: .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: .Transform url: str view_bbox: unknown visible: bool zorder: float