Justin1209 Matplotlib
Justin1209 Matplotlib
plt.subplots_adjust( arguements)
Figures
left, right, top, bottom -margin
wspace, hspace horizontal/vertical margin between # Create Figure with custom size
plots plt.figure(figsize=( width, heigth ))
plt.plot(x, y)
The object that contains all subplots is called figure
plt.savefig('tall_and_narrow. png/ .svg/ .pdf')
Always put specific Attributes (color, markers, ...) for a subplot
directly under plt.plot() When we’re making lots of plots, it’s easy to end up with lines that
have been plotted and not displayed. If we’re not careful, these
Linestyles “forgotten” lines will show up in your new plots. In order to be sure
plt.plot(x, y, style=" ") that you don’t have any stray lines, you can use the command plt.c‐
lose('all') to clear all existing plots before you plot a new one.
Keywords to put in for style:
We use range(len(y_values)) to get a tick for each value we want to plt.bar(y, x, yerr=yerr, capsize=10)
Pie Chart
Histogram
# Specify alpha for opacity or use histtype to draw just the outline
# Use linewidth to specifiy the linewidth of the outline
# Use the keyword normed to normalize the histograms