0

I am ploting by below code

fig, ((ax1, ax2 ,ax3,ax4)) = plt.subplots(2,2,sharex='col', sharey='row')
sns.set_style("white")
a=sns.kdeplot(hour_listm[1], dfm[1].K,ax=ax1, cmap="PuBuGn",shade=True,cbar=False, shade_lowest=False)
b=sns.kdeplot(hour_listm[2], dfm[2].K,ax=ax2, cmap="PuBuGn",shade=True,cbar=False, shade_lowest=False)
c=sns.kdeplot(hour_listm[3], dfm[3].K,ax=ax3, cmap="PuBuGn",shade=True,cbar=False, shade_lowest=False)
d=sns.kdeplot(hour_listm[4], dfm[4].K,ax=ax4, cmap="PuBuGn",shade=True,cbar=False, shade_lowest=False)
for ax in fig.get_axes():
    ax.set_ylim(0,0.5)
    ax.set_xlim(0,23)
    ax.label_outer()

Now if do cbar=True. I will get colorbar for each subplot. But I want only one colorbar for all the plot at a particular position. So how to do that? Any suggestions please.

Mr. T
  • 11,960
  • 10
  • 32
  • 54
avi
  • 85
  • 8
  • Not kdeplots but the strategy should be the same: [One colorbar for seaborn heatmaps in subplot](https://stackoverflow.com/questions/28356359/one-colorbar-for-seaborn-heatmaps-in-subplot) – Mr. T Jan 13 '21 at 13:16
  • But in this case, they use the same data for every subplot. In my case, dataset will change in every subplot. – avi Jan 13 '21 at 13:44
  • Valid point. You can set the limits of the colorbar afterward but I have no time at the moment to look for a duplicate. – Mr. T Jan 13 '21 at 13:46
  • No. I want to mean that I have to vary the dataset. They use only one dataset. Like hour_listm[1], dfm[1].K hour_listm[2], dfm[2].K but they use only df – avi Jan 13 '21 at 14:13

0 Answers0