My objective is to create a 2x2 figure where each cell in each grid is on the same color scale. Currently, I haven't found a compound plot option in GeoPandas that allows me to plot one GeoDataFrame and split it by hue or column to keep the scale the same. The problem is that the values in the bottom left plot are actually much higher but are not captured because it has its own pysal categorization from GeoPandas.plot(). My current code:

import geopandas as gpd
import matplotlib.pyplot as plt 
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2, figsize=(12, 16))
ax1 = PPR.plot(ax=ax1,cmap='gist_gray_r', linewidth=2,edgecolor='black')
rp1.plot(ax=ax1, column= 'model_benefit',cmap='gist_heat_r', linewidth=0.1, edgecolor='white')
ax1.set_title('map 1', fontsize=20, fontweight='bold')\

ax2 = PPR.plot(ax=ax2,cmap='gist_gray_r', linewidth=2,edgecolor='black')
sp1.plot(ax=ax2, column= 'model_benefit',cmap='gist_heat_r', linewidth=0.1, 
ax2.set_title('map 2', fontsize=20, fontweight='bold')

ax3 = PPR.plot(ax=ax3,cmap='gist_gray_r', linewidth=2,edgecolor='black')
rp2.plot(ax=ax3, column= 'model_benefit',cmap='gist_heat_r', linewidth=0.1, edgecolor='white')
ax3.set_title('map3', fontsize=20, fontweight='bold')

ax4 = PPR.plot(ax=ax4,cmap='gist_gray_r', linewidth=2,edgecolor='black')
sp2.plot(ax=ax4, column= 'model_benefit',cmap='gist_heat_r', linewidth=0.1, 
ax4.set_title('map4', fontsize=20, fontweight='bold')

And the output: Does anyone have a way to create a color map of string/values using the matplotlib "OrYlRd" cmap then assign a color to a value in the dataframe? Or an alternate approach for customizing color palettes in GeoPandas plotenter image description here

  • 1
    solved by Spotter. Add vmin=min and vmax=max to keyword arguments! – dand Feb 15 '18 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.