Pandas-Bokeh icon indicating copy to clipboard operation
Pandas-Bokeh copied to clipboard

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

Open sufyankazi opened this issue 3 years ago • 1 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?

sufyankazi avatar Jul 06 '21 20:07 sufyankazi

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

PatrikHlobil avatar Jul 08 '21 20:07 PatrikHlobil