How Can I Add A Label To Colorbar Using Imagegrid?
In a previous question, colobar label matplotlib in ImageGrid, had a solution for adding a label to the colorbar, but this seems to be broken with the current version. Platforms I
Solution 1:
Personally, I've always perceived matplotlib
as black magic, similar to TeX
, so I cannot guarantee that my answer is the "official" way of doing what you want, or that it will continue to work in later versions. But thanks to this gallery example, I could devise the following incantation:
grid[0].cax.colorbar(im)
cax = grid.cbar_axes[0]
axis = cax.axis[cax.orientation]
axis.label.set_text("$[a.u.]$")
(don't forget to remove all your colorbar-related code). This works in the current matplotlib
version (1.4.3). The result:
Post a Comment for "How Can I Add A Label To Colorbar Using Imagegrid?"