Commit 54a38138 authored by Andrija Kostic's avatar Andrija Kostic
Browse files

A quick fix to make the colorbars nicer and adapt their size to the 2D plots canvas

parent 31318be2
Pipeline #105327 failed with stages
in 56 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