Show Menu
Cheatography

Matplotlib Cheat Sheet (DRAFT) by

This sheet resume all the plot you can create with the matplotlib library

This is a draft cheat sheet. It is a work in progress and is not finished yet.

parameters

x
data position
y
data position
c
marker color
alpha
transp­arence
marker
marker style
cmap
Color map (only used if c is an array of float)

Basic plot

scatter
plt.sc­att­er(x, y, c)
histog­ramme
plt.hi­st(x, c, bins)
histog­ramme (2D)
plt.hi­st2d(x, y, cmap, bins)
Contour plot
plt.co­nto­ur(x, y, z, [level], colors)
Contour plot avec gradient
plt.co­nto­urf(x, y, z, cmap)
 

Marker type

.
point
,
pixel
o
cercle
+
plus
x
croix
s
square
D
diamond

Complex plot

Image
plt.im­show(x)
nuage de point
plt.ax­es(­pro­jec­tio­n='3d')
Pour un nuage de point, inclure :
from mpl.to­olk­its.mp­lot3d import Axes3D
 

colormap

viridis (default)
plasma
magma
inferno
seismic
hsv