How To Stop `colorbar` From Reshaping `networkx` Plot? (python 3)
I am trying to change the colorbar on my networkx plot. The bar gets extra wide and also smooshes my original networkx plot (left) when I add the colorbar on there (right). How c
Solution 1:
Easiest way should be to plot the colorbar on its own axis and play around with the [left, bottom, width, height] parameters.
cbaxes = fig.add_axes([0.9, 0.1, 0.015, 0.8])
sm = plt.cm.ScalarMappable(cmap=ListedColormap(color_palette),
norm=plt.Normalize(vmin=0, vmax=3))
sm._A = []
plt.colorbar(sm, cax=cbaxes, ticks=range(4))
Source: positioning the colorbar
Post a Comment for "How To Stop `colorbar` From Reshaping `networkx` Plot? (python 3)"