fastplotlib.layouts.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

Examples#

Small Image

Small Image

Simple Image

Simple Image

RGB Image

RGB Image

Image Colormap

Image Colormap

RGB Image Vmin/Vmax

RGB Image Vmin/Vmax

Image Vmin/Vmax

Image Vmin/Vmax

Heatmap or large arrays

Heatmap or large arrays

GridPlot Non-Square Example

GridPlot Non-Square Example

GridPlot Simple

GridPlot Simple

Multi-Graphic GridPlot

Multi-Graphic GridPlot

Line Plot Colormap

Line Plot Colormap

Simple Line Plot

Simple Line Plot

Line Plot Data Slicing

Line Plot Data Slicing

Lines more colormapping

Lines more colormapping

Line Plot Color Slicing

Line Plot Color Slicing

Line Stack

Line Stack

Line Collection Simple

Line Collection Simple

Line Collection Colors

Line Collection Colors

Line collections quantitative cmap

Line collections quantitative cmap

Line Collection Qualitative Colormap

Line Collection Qualitative Colormap

Line collection slicing

Line collection slicing

Line stack 3D

Line stack 3D

Iris Scatter Plot Color Slicing

Iris Scatter Plot Color Slicing

Iris Scatter Colormap

Iris Scatter Colormap

Iris Scatter Plot

Iris Scatter Plot

Iris Scatter Plot Data Slicing

Iris Scatter Plot Data Slicing

Scatter Plot Data Slicing

Scatter Plot Data Slicing

Scatter Plot

Scatter Plot

Scatter Colormap

Scatter Colormap

Scatter Plot Color Slicing

Scatter Plot Color Slicing

Scatter Plot Size

Scatter Plot Size

Rectangle Selectors Images

Rectangle Selectors Images

Rectangle Selectors

Rectangle Selectors

Linear Selectors Image

Linear Selectors Image

LinearRegionSelectors with LineCollection

LinearRegionSelectors with LineCollection

LinearRegionSelectors

LinearRegionSelectors

LinearRegionSelectors match offsets

LinearRegionSelectors match offsets

Linear Selectors

Linear Selectors

ImGUI Basics

ImGUI Basics

Simple Image Update

Simple Image Update

Scatter sizes animation

Scatter sizes animation

Simple Line Animation

Simple Line Animation

Simple Event

Simple Event

Simple 3D Line Animation

Simple 3D Line Animation

Multi-Subplot Image Update

Multi-Subplot Image Update

Scatter Animation Data

Scatter Animation Data

Scatter Animation Colors

Scatter Animation Colors

Lorenz System Animation

Lorenz System Animation

Electromagnetic Wave Animation

Electromagnetic Wave Animation

Minimal Qt

Minimal Qt

Embed within a Qt Window

Embed within a Qt Window