POST POST

OCT
22
2021

Mathplotlib cheat sheet

ORIGINALLY POSTED TO: https://blog.simontimms.com/2021/10/22/matplotlib-cheat-sheet

Part of an evolving cheat sheet

Include the library

1
import matplotlib.pyplot as plt

Set the plot size to be larger

1
plt.rcParams['figure.figsize'] = [30, 21]

Set plot title

1
plt.title("some title)

Plot a line chart

1
2
plt.plot(filtered['datetime'], filtered['totalsales'], label="Sales Ingest")
plt.show()

Add Legend

1
plt.legend()

Simon Timms

Email Email
Web Web
Twitter Twitter
GitHub GitHub
RSS

Looking for someone else?

You can find the rest of the Western Devs Crew here.

© 2015 Western Devs. All Rights Reserved. Design by Karen Chudobiak, Graphic Designer