UI
Matplotlib
Display Matplotlib plots in your Preswald application
The Matplotlib widget allows you to seamlessly display Matplotlib plots in your Preswald application. It renders plots as images within a card container, providing a clean and consistent presentation.
Properties
Property | Type | Required | Default | Description |
---|---|---|---|---|
_label | string | No | - | Title text displayed above the plot |
image | string | No | - | Base64-encoded PNG image data of the plot |
className | string | No | ” | Additional CSS classes to apply to the container |
Basic Usage
Examples
Plot with Custom Title
Multiple Plots
Custom Styling
Notes
- The widget automatically handles the conversion of Matplotlib plots to images
- Plots are displayed responsively, adjusting to the container width
- If no plot data is available, a “No plot available” message is shown
- Use
plt.figure()
to create new figures when displaying multiple plots - The widget supports all types of Matplotlib plots: line plots, scatter plots, histograms, etc.
Was this page helpful?