For AI agents: the complete documentation index is at llms.txt. Markdown versions are available by appending .md or sending Accept: text/markdown.
Reflex Logo
Docs Logo
Library

/

Graphing

/

Other Charts

/

Pyplot

Pyplot

Pyplot (reflex-pyplot) is a graphing library that wraps Matplotlib. Use the pyplot component to display any Matplotlib plot in your app. Check out Matplotlib for more information.

Installation

Install the reflex-pyplot package using pip.

Basic Example

To display a Matplotlib plot in your app, you can use the pyplot component. Pass in the figure you created with Matplotlib to the pyplot component as a child.

Expand

Stateful Example

Lets create a scatter plot of random data. We'll also allow the user to randomize the data and change the number of points.

In this example, we'll use a color_mode_cond to display the plot in both light and dark mode. We need to do this manually here because the colors are determined by the matplotlib chart and not the theme.

Number of Points:

Expand

API Reference

pyplot

Display a Matplotlib chart.

Props

No component specific props

Built with Reflex