What I want is to have two axes grids, one rectangular and one polar, covering the same square axes.
The way I do that is:
fig1,ax = plt.subplots()
(this draws the rectangular axes)
rect = ax.get_position().bounds
ax_polar = fig1.add_axes(rect,polar=True,frameon=True)
(this draws the polar axes)
However, I also need to add a colorbar to this plot. One way to precisely locate the colorbar is to use:
cax = divider.append_axes("right",size="5%",pad=0.2)
cb = fig1.colorbar(im,cax=cax,...)
But when I do this, the rectangular axes resize and the polar axes go out of sync. If I try to retrieve the
ax boundaries as above, I get the same values–presumably because
ax has been subdivided, so it together with
cax covers the same extent–which is not what I need. In other words, after the resizing because of divider, the bounds of
ax do not get updated.
Is there a solution? Or an easier way to create the two axes and have them permanently tied together?