asked    Barnett     2018-10-22       python       86 view        1 Answer

[SOLVED] Moving label of seaborn colour bar

I've got a seaborn heat map with a labelled colour bar using:

seaborn.heatmap(df, cbar_kws = {'label': 'Label for colour bar axis'})

but the colourbar's label overlaps with its tick labels. Is there a way to reposition this label further from the ticks (in my case, further to the right) like the 'padding' options for a normal matplotlib plot?

  1 Answer  

        answered    Morgan     2018-10-22      

Unfortunately cbar_kws doesn't accept the labelpad argument. Therefore one way to add some padding to the labels will be to access the colorbar after it has been drawn.

You can use ax.collections[0].colorbar to get access to the matplotlib.colorbar.Colorbar object. This then lets you use the colobar as you normally would with matplotlib. So, you can use set_label() to set your colorbars label, and you can use the labelpad= argument:

import seaborn as sns

uniform_data = np.random.rand(10, 12) # random data
ax = sns.heatmap(uniform_data)

cbar = ax.collections[0].colorbar
cbar.set_label('Label for colour bar axis', labelpad=40)

enter image description here

Your Answer

 2018-10-22         Burnell

After logging in I am redirected to /robots.txt

So since a couple of weeks now we have noticed some strange behaviour on a couple of projects that use Spring Boot and Spring Security.Mostly only OSX users seem to have this issue but whenever we login to our application it randomly redirects back to robots.txtI realise that this is probably not enough info, but sadly it's all I got. We have seen this pop up only on OSX so far and on 3 different projects (some live and some running locally)server logs have this as request info (I removed/obfuscated some the real info):Request parameters:Request attributes:javax.servlet.for...
 spring-boot                     1 answers                     64 view
 2018-10-22         Andy

Stanford CoreNLP Server: Reduce memory footprint

I am acessing the CoreNLP Server from a Python script running in Jupyter Lab. I am using the full annotator suite to extract quotes from newspaper articles.request_params={'annotators': "tokenize,ssplit,pos,lemma,ner,depparse,coref,quote",...As against the recommended 2GB, I have allocated 4GB and yet the quote annotator fails to load. Windows task manager shows memory utilization at >94% for long periods. Where can I get a list of options that I can tune to improve memory use? The coreference models are probably the main culprit. If you don't care about quote attribut...
 stanford-nlp                     1 answers                     67 view
 2018-10-22         Ethel

Kendo UI Issue with latest MSCRM Online version 9.0.2.x

In this post:Web Resource in Dynamics 365—Kendo UI destroyed by jQuery loaded by ClientGlobalContext.js.aspxit is stated: In version of Dynamics 365 online, I found that the newer version of ClientGlobalContext.js.aspx loads its own version of jQuery without checking to see if one is already present.How can I determine if the newer version of ClientGlobalContext.js.aspx loads its own version of jQuery without checking to see if one is already present? I believe I may have same issue as in the linked question, but I'm unsure how I could diagnose that I'm in fact fa...
 kendo-ui                     1 answers                     64 view