-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
Milestone
Description
Hi, all. There have been some discussions about using axes_grid1.AxisDivider
with polar projected images to make axis for a colorbar with proper height/width (E.g., my comment on an old issue #3286 and ). It appears to me that there is a bug in axes_grid1.axes_size.AxisX
and AxisY
that assume rectangular projection.
I changed mpl_toolkits.axes_grid1.axes_size.py
a little to support polar projection (almost) properly. Please see https://gist.github.com/jimgreen/839f43897e9c1d54f6fb4b890a93ee1b for a working example.
The result after fixing is of the left, and the simple call to plt.colorbar() is on the right:
I wonder if this the right thing to do? And, perhaps we need to support other projections, too?
PS:
- I also forced to use
axes_class=matplotlib.axes._axes.Axes
individer.append_axes
to get the proper axis forcolorbar
. Otherwise the returned ax would have same projection as the input ax, which is polar. - The often suggested solution of using
GridSpec
is also nice (see https://stackoverflow.com/questions/24894625/adding-a-colorbar-to-a-pcolormesh-with-polar-projection). But it (to me) is a very different solution to theaxes_grid1
way.