Skip to content

Instantly share code, notes, and snippets.

@cvr
Created October 21, 2011 14:32
Show Gist options
  • Save cvr/1303988 to your computer and use it in GitHub Desktop.
Save cvr/1303988 to your computer and use it in GitHub Desktop.
Set a title on top of a colorbar
fig=plt.figure()
## AXES HANDLE
ax=fig.add_axes(mpltr.Bbox([[ .14 , .14 ],[ .90 , .92 ]]))
## COLORBAR AXES HANDLE
cx=fig.add_axes(mpltr.Bbox([[ .91 , .14 ],[ .93 , .92 ]]))
...
## PLOT THE STUFF YOU WANT
ax.contourf(X, Y, Z, etc... )
...
## COLORBAR
cb=plt.colorbar(cf, cax=cx)
plt.figtext(.91, .92, (r"Variable Z"), va='bottom', ha='left')
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment