PatrikHlobil / Pandas-Bokeh

Bokeh Plotting Backend for Pandas and GeoPandas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: mpl palettes and bokeh palettes do not work with geoplot

sufyankazi opened this issue · comments

I'm trying to plot with a custom colorbar and colormap, but I'm unable to do it. I haven't found a way to add it in.

#matplotlib mapper -> does not work
mapper = CategoricalColorMapper(palette=['#66ff00', '#32cd32', 'yellow', 'red'], 
                                factors=['A', 'B', 'C', 'D'])
#bokeh mapper -> does not work
color_mapper = LinearColorMapper(palette='Magma256', 
                                 low=2000000, 
                                 low_color='red', 
                                 high=500000,
                                 high_color='#66ff00')

p = plot_df.plot_bokeh(simplify_shapes=10000, 
                     category="target1", 
                     colormap=mapper
                       colorbar_tick_format="0.0a",
                     hovertool_columns=["target1"],
                     figsize=(900,600))

I am trying to make a custom colorbar with where values are transformed to a custom mapper like this:

0-199 -> red,
200-299 -> 'orange'
300-599 -> 'yellow'
600+ -> 'green'

see here for more details
https://stackoverflow.com/questions/68275944/how-to-make-a-custom-colorbar-and-fill-color-with-geopandas-and-bokeh?

Hi @sufyankazi,

this is currently not supported by pandas-bokeh. you can only use the buildin colormaps or list of colors. could you give a minimal code example in which such a feature would be nice to have?

Best Patrik