How to make figures for publications

From ChengLab
Revision as of 19:36, 9 April 2019 by Kevin (talk | contribs) (Matplotlib)
Jump to: navigation, search

Matplotlib

Subplots

fig, axes = plt.subplots(nrows=2, ncols=2)
for ax in axes.flat:
   im = ax.imshow(np.random.random((10,10)), vmin=0, vmax=1)

Add colorbar

fig.subplots_adjust(right=0.8)
cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
fig.colorbar(im, cax=cbar_ax)