2

I am trying to plot a map using geopandas and seaborn. My problem is that the color legend's height extends beyond the height of my figure. How can I control its orientation, height, width etc to avoid this problem?

Here is my code:

import numpy as np
fig,axes = plt.subplots(nrows=2,ncols=2, figsize=(6.2,6),dpi=600)
cols = cresult.columns[1:5]
cols = np.array(cols)
cols=cols.reshape(2,2)
title = np.array(['(a)','(b)','(c)','(d)']).reshape(2,2)
sns.set(context='paper', style='ticks',)

for i in range(2):
    for j in range(2):
        btnshp.plot(ax=axes[i,j], color='w', edgecolor='black')
        Gcresult.plot(ax=axes[i,j], label=cols[i,j], column=cols[i,j], 
        cmap='viridis', markersize=15,legend=True)
        axes[i,j].set_xlabel(title[i,j])

plt.tight_layout() 

This is what I have so far, you can see that the color legend is too big for the map:

enter image description here

ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712
  • [This](https://stackoverflow.com/questions/18195758/set-matplotlib-colorbar-size-to-match-graph) is the problem. Probably none of the solutions are helpful here though. – ImportanceOfBeingErnest Dec 21 '18 at 22:45

0 Answers0