Question

I have several fcontour plots, each with a colorbar. For the colorbar I'm creating extra axis. It is possible to set the position of the colorbar axis relative to their fcontour axis? Im only able to set the position from axis relative to the figure. Thanks!

Was it helpful?

Solution

After reading the docs about mpl_toolkit.axes_grid as tcaswell suggested, I used divider = make_axes_locatable(ax) and cax = divider.append_axes("right", size="4.45%", pad=0.07,aspect = True). Usually divider.append_axes appends an axes with the same height to your plot, but as it seems you can change that setting aspect = True, and then modifying the aspect via cax.set_aspect and the size of your new axes.

The result is a colorbar which ALWAYS is beside its plot, and in my case it is a little shorter than the plot itself. thanks tcaswell! :D

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top