I'm creating a map of zipcodes in the US with a colorbar based on numerical values.
My data looks like
index target1 color geodata...
0 2000000 'yellow' XXXX
My code is:
import geopandas as gp
import pandas_bokeh
import bokeh
import matplotlib.pyplot as plt
from bokeh.plotting import figure, output_file, save
from bokeh.models import LinearColorMapper, CategoricalColorMapper
mapper = CategoricalColorMapper(palette=['#66ff00', '#32cd32', 'yellow', 'red'],
factors=['#66ff00', '#32cd32', 'yellow', 'red'])
p = plot_df.plot_bokeh(simplify_shapes=10000,
category="target1",
color=mapper,
hovertool_columns=["target1"],
figsize=(900,600))
My map looks like this:
I want to change the colorbar and fillcolor of zips to a 4 color bar with set numbers
0-199 -> red,
200-399 -> 'orange'
400-599 -> 'yellow'
600-799 -> 'green'
I've tried a few different methods (trying to change the color after mapping with p.patches()
, passing mapper
to plot_bokeh
but none has worked.