python - Set Matplotlib colorbar size to match graph -
i cannot colorbar on imshow graphs 1 same height graph, short of using photoshop after fact. how heights match?
you can matplotlib axisdivider.
the example linked page works without using subplots:
import matplotlib.pyplot plt mpl_toolkits.axes_grid1 import make_axes_locatable import numpy np plt.figure() ax = plt.gca() im = ax.imshow(np.arange(100).reshape((10,10))) # create axes on right side of ax. width of cax 5% # of ax , padding between cax , ax fixed @ 0.05 inch. divider = make_axes_locatable(ax) cax = divider.append_axes("right", size="5%", pad=0.05) plt.colorbar(im, cax=cax)
Comments
Post a Comment