Aggialavura Python-Matplotlib - BW
Aggialavura Python-Matplotlib - BW
plt.subplot(r,c,1)* create multiplots subplot() command requires to specify the number of row and
plt.plot(x, y) column we want to print the plots, and the third parameter specify
plt.subplot(r,c,2) what of the graph we are going to handle.
plt.plot(y, x, 'g*-') axes: ([left, bottom, width, height])
OBJECT ORIENTED METHOD (more control) fig, axes allow you to auto-manage axis, you don't have to create
them. Axes, now, will be an array of axis.We could use for loop to
fig = plt.figure() create canvas
populate labels on axis.
ax = fig.add_axes([0,0,1,1]) create axes*
ax.plot(x, y, 'b') create plot
COLORS, LINEWIDTHS, LINETYPES
ax.set_xlabel(''str) set x label
ax.set_ylabel('str') set y label fig = plt.figure() ----
ax.set_title(''str) set title ax = fig.add_axes([0,0,1,1]) ----
ax.plot(x,y ----
** add more axis to have more figures
color='#xxxxxx', set color
fig, ax = plt.subplots(r,c)* subplots
lw=x, set linewidth
axes[0].plot(x,y) create pl ax1
alpha=x, set alpha
axes[1].plot(x,y) create pl ax2
ls='', set linestyle
axes[0].set_title('str') set plot 1 title
marker='', set markertype
axes[1].set_title(''str) set plot 2 title
markersize=x, set marker size
subplot() command requires to specify the number of row and markerfacecolor='', set mark color
column we want to print the plots, and the third parameter specify markeredgecolor='', set external col
what of the graph we are going to handle. markeredgewidth=x) set marker wdt
axes: ([left, bottom, width, height])
ax.set_xlim([0,1]) set x axes limit
fig, axes allow you to auto-manage axis, you don't have to create
ax.set_ylim([0,1]) set y axes limit
them. Axes, now, will be an array of axis.We could use for loop to
populate labels on axis. ax.plot(x, y, 'r--') MATLAB style
cheatography.com/aggialavura/