In relation to the accepted response to this question:
What if I wanted to use 3 or more different, custom colors? Is it an easy edit to LinearSegmentedColormap?
This works for 2:
import numpy as np
import geopandas as gpd
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
shpfile = 'cb_2015_us_county_20m.shp'
c = gpd.read_file(shpfile)
c = c.loc[c['GEOID'].isin(['26161','26093','26049','26091','26075',
'26125','26163','26099','26115','26065'])]
c['color'] = np.zeros(len(c))
# 23 is index for Washtenaw county and 1992 is index for Wayne county
c.ix[23, 'color'] = 1.0
c.ix[1992, 'color'] = 1.0
# create simple linear colormap that maps grey to blue
cmap = LinearSegmentedColormap.from_list(
'mycmap', [(0, 'grey'), (1, 'blue')])
c.plot(column='color', cmap=cmap)
For 3, I tried:
cmap = LinearSegmentedColormap.from_list(
'mycmap', [(0, 'grey'), (0.5, 'red'), (1, 'blue')])
Thanks in advance!