Matplotlib - Pyplot Cheat Sheet: by Via
Matplotlib - Pyplot Cheat Sheet: by Via
Pie chart plt.pie() (data, labels = list) plt.xscale("scale Set scale for the x axis a variable
type") (ex. "log") cm = plt.cm.get_cmap("RdYlBu")
Optional arguments plt.yscale("scale Set scale for the y axis # Set the color map in a plot
type") (ex. "log") plt.scatter(x_data, y_data,
color Change plot color
="color" plt.twinx() Add a second y axis cmap=cm)
marker = Change marker for line or scatter plt.axis("off") Do not show the axes
See all colormaps here:
"symbol" plot (".", "x", "|", "o") plt.gca().invert_ Invert the x axis https://matplotlib.org/users/colormaps.html
markersize Change marker size xaxis()
int
Labeling functions
cmap = Color plot according to a
colormap colormap plt.title("title") Add a title