Commit c9687c8a authored by Martin Reinecke's avatar Martin Reinecke
Browse files

Merge branch 'akostic-NIFTy_7-patch-16577' into 'NIFTy_7'

Make the colorbars nicer and adapt their size to the 2D plots canvas

See merge request !660
parents 31318be2 55910e94
Pipeline #105714 passed with stages
in 30 minutes and 49 seconds
...@@ -415,11 +415,17 @@ def _plot2D(f, ax, **kwargs): ...@@ -415,11 +415,17 @@ def _plot2D(f, ax, **kwargs):
rgb, extent=[0, nx*dx, 0, ny*dy], origin="lower", **norm, rgb, extent=[0, nx*dx, 0, ny*dy], origin="lower", **norm,
**aspect) **aspect)
else: else:
from mpl_toolkits.axes_grid1 import make_axes_locatable
im = ax.imshow( im = ax.imshow(
f.val.T, extent=[0, nx*dx, 0, ny*dy], f.val.T, extent=[0, nx*dx, 0, ny*dy],
vmin=kwargs.get("vmin"), vmax=kwargs.get("vmax"), vmin=kwargs.get("vmin"), vmax=kwargs.get("vmax"),
cmap=cmap, origin="lower", **norm, **aspect) cmap=cmap, origin="lower", **norm, **aspect)
plt.colorbar(im)
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.05)
plt.colorbar(im, cax=cax)
_limit_xy(**kwargs) _limit_xy(**kwargs)
return return
elif isinstance(dom, (HPSpace, GLSpace)): elif isinstance(dom, (HPSpace, GLSpace)):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment