Matplotlib#

This component is also available in the classic reference.

The Matplotlib pane allows displaying any displayable Matplotlib figure inside a Panel app.

Use pn.ui.Matplotlib to create this component.

API#

.. py:class:: Matplotlib(object=None, **params) :module: panel.pane.plot

The Matplotlib pane allows displaying any displayable Matplotlib figure inside a Panel app.

  • It will render the plot to PNG at the declared DPI and then embed it.

  • If you find the figure to be clipped on the edges, you can set tight=True to automatically resize objects to fit within the pane.

  • If you have installed ipympl you will also be able to use the interactive backend.

Reference: https://panel.holoviz.org/reference/panes/Matplotlib.html

:Example:

Matplotlib(some_matplotlib_figure, dpi=144)

:Attributes:

   **filetype**
       ..

   **object**
       ..

.. rubric:: Methods

.. autosummary::

  applies

.. !! processed by numpydoc !!

Parameter Definitions


Parameters inherited from:

   :class:`panel.viewable.Layoutable`: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

   :class:`panel.viewable.Viewable`: loading

   :class:`panel.pane.base.PaneBase`: margin, default_layout

   :class:`panel.pane.markup.HTMLBasePane`: enable_streaming

   :class:`panel.pane.image.FileBase`: embed

   :class:`panel.pane.image.ImageBase`: alt_text, caption, fixed_aspect, link_url, target

object = Parameter(allow_None=True, allow_refs=True, label='Object')

    The Matplotlib Figure being wrapped, which will be rendered as a
    Bokeh model.

dpi = Integer(bounds=(1, None), default=144, inclusive_bounds=(True, True), label='Dpi')

    Scales the dpi of the matplotlib figure.

encode = Boolean(default=False, label='Encode')

    Whether to encode SVG out as base64.

format = Selector(default='png', label='Format', names={}, objects=['png', 'svg'])

    The format to render the plot as if the plot is not interactive.

high_dpi = Boolean(default=True, label='High dpi')

    Whether to optimize output for high-dpi displays.

interactive = Boolean(constant=True, default=False, label='Interactive')

    Whether to render interactive matplotlib plot with ipympl.

tight = Boolean(default=False, label='Tight')

    Automatically adjust the figure size to fit the
    subplots and other artist elements.

.. py:method:: Matplotlib.applies(object: ~typing.Any) -> float | bool | None :module: panel.pane.plot :classmethod:

  Returns boolean or float indicating whether the Pane
  can render the object.

  If the priority of the pane is set to
  `None`, this method may also be used to define a float priority
  depending on the object being rendered.















  ..
      !! processed by numpydoc !!