edit on Repl.it

Interactive Python Plots

Though the console only supports text output, we provide with the ability 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, the first thing you have to do is 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're just going to do something simple:

plt.plot([1,2,3])

Now that we have a plot, we simple use plt.show() to open a new window with the plot.

plt.show()

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.