fastplotlib.Figure¶

class Figure(shape=(1, 1), cameras='2d', controller_types=None, controller_ids=None, controllers=None, canvas=None, renderer=None, size=(500, 300), names=None)[source]¶

A grid of subplots.

Parameters:
  • shape ((int, int), default (1, 1)) – (n_rows, n_cols)

  • cameras ("2d", "3", list of "2d" | "3d", Iterable of camera instances, or Iterable of "2d" | "3d", optional) –

    if str, one of "2d" or "3d" indicating 2D or 3D cameras for all subplots
    Iterable/list/array of 2d and/or 3d that specifies the camera type for each subplot
    Iterable/list/array of pygfx.PerspectiveCamera instances

  • controller_types (str, Iterable, optional) – list/array that specifies the controller type for each subplot. Valid controller types: “panzoom”, “fly”, “trackball”, “orbit”. If not specified a default controller is chosen based on the camera type. Orthographic projections, i.e. “2d” cameras, use a “panzoom” controller by default. Perspective projections with a FOV > 0, i.e. “3d” cameras, use a “fly” controller by default.

  • controller_ids (str, list of int, np.ndarray of int, or list with sublists of subplot str names, optional) –

    If None a unique controller is created for each subplot
    If “sync” all the subplots use the same controller
    If array/list it must be reshapeable to grid_shape.

    This allows custom assignment of controllers

    Example with integers:
    sync first 2 plots, and sync last 2 plots: [[0, 0, 1], [2, 3, 3]]
    Example with str subplot names:
    list of lists of subplot names, each sublist is synced: [[subplot_a, subplot_b, subplot_e], [subplot_c, subplot_d]]
    this syncs subplot_a, subplot_b and subplot_e together; syncs subplot_c and subplot_d together

  • controllers (pygfx.Controller | list[pygfx.Controller] | np.ndarray[pygfx.Controller], optional) – directly provide pygfx.Controller instances(s). Useful if you want to use a controller from an existing plot/subplot. Other controller kwargs, i.e. controller_types and controller_ids are ignored if controllers are provided.

  • canvas (WgpuCanvas, optional) – Canvas for drawing

  • renderer (pygfx.Renderer, optional) – pygfx renderer instance

  • size ((int, int), optional) – starting size of canvas, default (500, 300)

  • names (list or array of str, optional) – subplot names