plot
Demonstrating plotting with geopandas
Note that this relies on a development branch of geopandas: https://github.com/sjsrey/geopandas/tree/legendkwds that is planned for submission to geopandas.
import libpysal
import geopandas as gpd
import mapclassify as mc
columbus = gpd.read_file(libpysal.examples.get_path('columbus.shp'))
q5 = mc.Quantiles(columbus.CRIME, k=5)
q5
q5.plot(columbus)
q5.plot(columbus, axis_on=False)
q5.plot(columbus, axis_on=False, cmap='Blues')
f = q5.plot(columbus, axis_on=False, cmap='Blues')
f = q5.plot(columbus, axis_on=False, cmap='Blues', title='Columbus, OH')
f = q5.plot(columbus, axis_on=False, cmap='Blues', title='Columbus, OH', \
legend=True)
f = q5.plot(columbus, axis_on=False, cmap='Blues', title='Columbus, OH', \
legend=True, legend_kwds={'loc':'upper right'})
f = q5.plot(columbus, axis_on=False, cmap='Blues', title='Columbus, OH', \
legend=True, legend_kwds={'loc':'upper left', 'title': 'Crime Rate'})
f = q5.plot(columbus, axis_on=False, cmap='Blues', title='Columbus, OH', \
legend=True, legend_kwds={'loc':'upper left', 'title': 'Crime Rate'}, \
file_name='crime.png')
f = q5.plot(columbus, axis_on=False, cmap='Blues', title='Columbus, OH', \
legend=True, legend_kwds={'loc':'upper left', 'title': 'Crime Rate, 1988'}, \
file_name='crime.png', border_color='green', border_width=2.0)
f = q5.plot(columbus, axis_on=False, cmap='Blues', title='Columbus, OH', \
legend=True, legend_kwds={'loc':'upper left', 'title': 'Crime Rate, 1988',
'fmt':'{:.1f}'}, \
file_name='crime.png', border_color='green', border_width=2.0)
f = q5.plot(columbus, axis_on=False, cmap='Blues', title='Columbus, OH', \
legend=True, legend_kwds={'loc':'upper left', 'title': 'Crime Rate, 1988',
'fmt':'{:.0f}'}, \
file_name='crime.png', border_color='green', border_width=2.0)