【问题标题】:Geoviews points: changing colormap with high and low optionsGeoviews 点:使用高低选项更改颜色图
【发布时间】:2018-08-14 12:14:13
【问题描述】:

我最近查看了 this question 手动设置全息视图颜色条的限制,但在更改我的一个 vdims 的范围后,它并没有改变颜色条的上限和下限。有没有办法为特定的 vdim 直接传递 Bokeh LinearColorMapper(及其选项)?

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})

【问题讨论】:

    标签: bokeh holoviews


    【解决方案1】:

    在设置点数之前,通过在我的数据集 locality_ratings 上调用 redim(aggregate_rating=dict(range=(0, 5))),我能够根据我的评分将颜色条的边界设置为 0 到 5。

        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"
                                                                                            )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-12
      • 1970-01-01
      相关资源
      最近更新 更多