Skip to main content

Creating interactive Python plots with matplotlib

Although the console only supports text output, Replit allows you to create plots and charts using matplotlib (and other libraries). Here, we will show you the basics of generating plots using Python3 and matplotlib.

In order to use matplotlib, you must first install the package, or simply import the package and we will auto-install it for you:

import matplotlib.pyplot as plt

Then, write the code to generate the plot as normal. In this example, we'll keep it simple:


Now that we have a plot, use to open a new window with the plot.

Running the code should then generate a new pane with your generated plot. Changing the plot and rerunning will update the graph in the display pane.

You can see the above example here: here.