Skip to content

Instantly share code, notes, and snippets.

@jklymak
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save jklymak/637c7ffe0701dacb9f4f to your computer and use it in GitHub Desktop.

Select an option

Save jklymak/637c7ffe0701dacb9f4f to your computer and use it in GitHub Desktop.
adjusting for colorbars
import numpy as np
import matplotlib.pyplot as plt
fig,ax=plt.subplots(2,1)
pcm0=ax[0].pcolormesh(np.random.randn(20,30))
fig.colorbar(pcm0,ax=ax[0],shrink=0.75)
pcm1=ax[1].pcolormesh(np.random.randn(20,30))
fig.colorbar(pcm1,ax=ax[1],shrink=0.75)
# or if you want one beside a bunch, you can make a list to steal from:
cax,kw = mpl.colorbar.make_axes([ax for ax in axs.flat],shrink=0.5)
plt.colorbar(pcm, cax=cax, **kw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment