Seaborn: clustermap - easy option to change colorbar location?

Created on 8 Jun 2015  Â·  6Comments  Â·  Source: mwaskom/seaborn

With very large clustermap (and figsize), the colorbar in the corner gets so tiny it is completely useless as a visual aide - it would be nice if you could say colorbar='location' (right, left, top, bottom) to put it in the more standard full scale on a side of the plot.

Most helpful comment

Yes to having a kws 'location' for cbar in clustermaps!

All 6 comments

No easy way to do it at present. Some work in #441 but that stalled out — it is tricky because there are textual labels over there too and it is hard to predict how large they will be.

+1 by default colorbar may look awful for large clustermap plots

+1

it would be great to have the option to move colorbar in different position!

Yes to having a kws 'location' for cbar in clustermaps!

There seems to have a parameter in clustermap function but it works badly. I don't know whether I have used it in a proper way.

cbar_pos tuple of (left, bottom, width, height), optional
Position of the colorbar axes in the figure. Setting to None will disable the colorbar.

I just create a new colorbar based on no map to deal with this problem.

first, remove the colorbar by setting cbar_pos = None.

and creat a colorbar like this:

#setting the scale
cbnorm = Normalize(vmin=0-0.5,vmax=5+0.5,clip=False) #setting the scale
cb = plt.colorbar(cm.ScalarMappable(norm=cbnorm, cmap=newcmp),fraction=1,ax=ax_color,ticks=np.arange(6))

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amelio-vazquez-reina picture amelio-vazquez-reina  Â·  3Comments

rrbarbosa picture rrbarbosa  Â·  3Comments

ConstantinoSchillebeeckx picture ConstantinoSchillebeeckx  Â·  4Comments

bondarevts picture bondarevts  Â·  3Comments

tritemio picture tritemio  Â·  3Comments