I'm completely new to shapefiles. I was able to use GeoPandas to plot some data over a map of the US I got from census.gov. I'm having getting the map to be at a viewable size. I adjusted the figsize parameter multiple times, but it doesn't seem to increase the size enough. From what I've read so far, shapefiles shouldn't be modified. How can I make the subplot larger?

map_df = gdp.read_file(shape_file)

covid_max_cap_df = hospital_data.groupby(['statename']).InBedsOccCOVID__Numbeds_Est.max()
covid_max_cap_df.drop('United States')

merged_map = map_df.set_index('NAME').join(covid_max_cap_df)
merged_map.rename(columns={'InBedsOccCOVID__Numbeds_Est':'covid_occ_rate'}, inplace=True)

var = 'covid_occ_rate'
vmin, vmax = covid_max_cap_df.min()-10, covid_max_cap_df.max()+10

fig, ax = plt.subplots(1,figsize=(30,30))
merged_map.plot(column=var, cmap='Reds', linewidth=0.8, ax=ax, edgecolor='0.8')
ax.set_title('COVID-19 Peak Hospital Occupancy Rate', fontdict={'fontsize':25, 'fontweight':3})
ax.annotate('Source: CDC, June 2020',xy=(0.1, .08),  xycoords='figure fraction', 
            horizontalalignment='left', verticalalignment='top', 
            fontsize=12, color='#555555')

sm = plt.cm.ScalarMappable(cmap='Reds', 
                              norm=plt.Normalize(vmin=vmin, vmax=vmax))
sm._A = []
cbar = fig.colorbar(sm)

enter image description here

  • You have some island geometry on the right side of the plot which causes the whole map to scale down. Jul 3, 2020 at 8:12
  • Can you set the axis limits?
    – wingnut
    Apr 25, 2021 at 6:01

1 Answer 1


As stated in geopandas documentation, you can use mpl_toolkits in order to fit and align the plot axes and the legend axes:

 from mpl_toolkits.axes_grid1 import make_axes_locatable
 fig, ax = plt.subplots(1, 1)
 divider = make_axes_locatable(ax)
 cax = divider.append_axes("right", size="5%", pad=0.1)
 adm_gdf.plot(column='pop_est', ax=ax, legend=True, cax=cax)


There are other interesting alternatives in this other question.

  • In your example, how do you increase the whole figure size vertically? Say, make it twice as tall - the whole image. Dec 6, 2020 at 7:00
  • I recommend posting another question with your problem. But you can see that the image adapts/fits to the bounds by default. If you want to change the fig size, check the docs. Dec 6, 2020 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.