0

I recently looked at this question on manually setting the limits of a holoviews colorbar, but after changing the range on one of my vdims, it didn't change the high and low limits of the colorbar. Is there a way to pass a Bokeh LinearColorMapper (and its options) directly for a particular vdim?

opts = {'plot' : dict(width=width_val, height=height_val, tools=[hover_shipments],
                  size_index='po_qty', 
                  color_index='magnitude',
                  size_fn=(lambda x : x/100),
                  click_policy='hide', colorbar=True),
   'style': dict(cmap='Viridis', line_width=0.25, alpha=0.75, fill_alpha=0.75,
                muted_alpha=0.05)}

ds_time_store.to(gv.Points, 
                      kdims=['longitude_qty','latitude_qty'], 
                      vdims=['store_num', 
                             'city_nm', 
                             'po_qty', 
                             hv.Dimension('magnitude', range=(0, 50))], label='late').opts({'Points' : opts})
Pallen
  • 131
  • 8

1 Answers1

1

By calling redim(aggregate_rating=dict(range=(0, 5))) on my data set locality_ratings before setting up the Points, I was able to set the boundaries for the colorbar from 0 to 5 as per my ratings.

    points = locality_ratings.redim(aggregate_rating=dict(range=(0, 5))).to(gv.Points, ['longitude', 'latitude'], 
                ['aggregate_rating', 'votes', 'cuisine_count', 'average_cost_for_two', 'price_range', 'locality'])
    (gts.Wikipedia * points.options(width=700, height=600, 
                            tools=['hover', 'save', 'zoom_in', 'zoom_out', 'pan' , 'wheel_zoom'],
                            colorbar=True, toolbar='above', xaxis=None, yaxis=None,
                            size_index=3, color_index=2, size=3, cmap=bokeh.palettes.all_palettes['Dark2'][5])).redim(longitude="Longitude",
                                                                                            latitude="Latitude",
                                                                                            aggregate_rating='Rating', 
                                                                                            locality="Locality",
                                                                                           votes="Votes",
                                                                                           price_range="Price Range",
                                                                                           average_cost_for_two="Avg. Cost for 2 (R)",
                                                                                           cuisine_count="No. Cuisines"
                                                                                        )