Matplotlib
Examples
[code lang=text]
choosing line with & color & label
plt.plot(X, Y, color=”red”, linewidth=2.5, linestyle=”-“, label=”sine”)
choosing color and intensity
plt.plot (X, Y, color=’blue’, alpha=1.00)
set legend loction & remove outer frame
plt.legend(loc=’upper left’, frameon=False)
setting tics for an axis
plt.yticks([-1, 0, +1])
intutive ticks for a axis
note: we are setting limits not ticks**
plt.xlim(X.min()1.1, X.max()1.1)
setting plot size and back-ground color
fig = plt.figure(figsize=(6,6), facecolor=’white’) [/code]
plt.figure attributes
num | 1 | number of figure |
figsize | figure.figsize | figure size in in inches (width, height) |
dpi | figure.dpi | resolution in dots per inch |
facecolor | figure.facecolor | color of the drawing background |
edgecolor | figure.edgecolor | color of edge around the drawing background |
frameon | True | draw figure frame or not |
Reference for