Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Stateful vs Stateless Approach

Give Feedback

One last piece of theory you need to understand is the differences between stateless and stateful interfaces. Pyplot is the stateful interface of matplotlib.

This means that, behind the scenes, Pyplot stores the state of your figure and axes objects, so you don’t have to. Pyplot is great for creating quick plots in an interactive shell.

This code example uses Pyplot to plot a basic line in a plot:

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(0, 1, 0.1)
y = np.arange(10)
plt.title("pyplot demo")

Comments & Discussion

Become a Member to join the conversation.