1

I would appreciate if you could let me know how to plot colorbar on the bottom of the heatmap plot. I read this post but since I am plotting a big heamap when I use the first answer i.e., cbar_kws = dict(use_gridspec=False,location="bottom") , the result is as provided here.

Also, if the third answer is applied i.e., cbar_kws = {'orientation':'horizontal'} , the result is as provided here.

My heatmap plot with colorbar on the right is here. I just want to change it's position, so it's length should be unchanged. The second answer increased it's length.

Thanks in advance.

ebrahimi
  • 912
  • 2
  • 13
  • 32
  • Your second result looks to have the colorbar at the bottom only! – Sumanth Rao Sep 12 '18 at 03:41
  • @svr_sum yes but it is too bigger than the heatmap plot. – ebrahimi Sep 12 '18 at 03:45
  • Can you create a [mcve] – DavidG Sep 12 '18 at 08:47
  • @DavidG Thanks. The code is the first answer to this post: https://stackoverflow.com/questions/50997662/how-to-plot-heatmap-for-high-dimensional-dataset . Besides, some part of the data set is also here: https://www.kaggle.com/shebrahimi/financial-distress – ebrahimi Sep 12 '18 at 09:23
  • One thing to note is that if you use a figsize of `(24, 18)` with a vertical colorbar, you should probably use a figsize of `(18, 24)` when using a horizontal colorbar, because the heatmap itself is square. – ImportanceOfBeingErnest Sep 12 '18 at 10:06
  • @ImportanceOfBeingErnest Thanks. I tried figsize of `(18,24)`. It could deal with the issue of the second solution but unfortunately, the issue is not resolved for the first solution. – ebrahimi Sep 12 '18 at 11:54
  • So what's wrong with using the second solution then? – ImportanceOfBeingErnest Sep 15 '18 at 16:34
  • @ImportanceOfBeingErnest. Thanks. the second solution is ok. Could you please let me know if it is possible to plot a big picture like this as 12 separate pictures (each separate picture would show some part of the big picture)? Something like [this](https://stackoverflow.com/questions/4534480/get-legend-as-a-separate-picture-in-matplotlib). Thanks. – ebrahimi Sep 19 '18 at 19:22
  • Sorry, I don't see the relation between this question and the linked question. Maybe it's better to ask a new one, with a clear description of what you want to do. – ImportanceOfBeingErnest Sep 19 '18 at 19:35
  • @ImportanceOfBeingErnest you're welcome. Sorry, I asked it [here](https://stackoverflow.com/questions/52417398/how-to-plot-a-big-picture-as-some-separated-pictures). – ebrahimi Sep 20 '18 at 04:03

1 Answers1

0

You could try altering the figsize of the graph like this:

import matplotlib.pyplot as plt

fig, axis = plt.subplots(figsize=(10,10))  #Try and set the fig size accordingly.   
sns.heatmap(df1,linewidths=.5,ax=axis) #df1 is your dataframe.
Sumanth Rao
  • 368
  • 1
  • 7