bqplot.pyplot.figure(key=None, fig=None, **kwargs)[source]

Creates figures and switches between figures.

If a bqplot.Figure object is provided via the fig optional argument, this figure becomes the current context figure.


  • If no key is provided, a new empty context figure is created.
  • If a key is provided for which a context already exists, the corresponding context becomes current.
  • If a key is provided and no corresponding context exists, a new context is reated for that key and becomes current.

Besides, optional arguments allow to set or modify Attributes of the selected context figure.

  • key (hashable, optional) – Any variable that can be used as a key for a dictionary
  • fig (Figure, optional) – A bqplot Figure