Using colormap with bokeh scatter

前端 未结 2 912
情深已故
情深已故 2021-02-08 08:03

In matplotlib the scatterplot offers the possibility of using the color of a plot to indicate value or magnitude like this plot:

For bokeh

2条回答
  •  既然无缘
    2021-02-08 08:39

    Another option if you want to use a field name, is to use a LinearColorMapper:

    from bokeh.models import LinearColorMapper
    
    color_mapper = LinearColorMapper(palette='Magma256', low=min(radii), high=max(radii))
    
    p.scatter(x,y,color={'field': 'radii', 'transform': color_mapper})
    

提交回复
热议问题