设置自定义刻度标签散景

Set custom tick labels Bokeh

我想在 0、25、50、75 和 100 处设置刻度线,所以我将它们定义为这样。

tick_labels = {0: "0%", 25: "25%", 50: "50%", 75: "75%", 100: "100%"}
color_bar = ColorBar(color_mapper = color_mapper,
                     label_standoff = 8,
                     width = 500, height = 20,
                     border_line_color = None,
                     location = (0,0), orientation = 'horizontal',
                     major_label_overrides = tick_labels
                    )

这只会覆盖 0 和 100 标签,其他所有内容(20、40 等)都有其默认标签。我该如何解决?我的猜测是我不应该覆盖主要的标签,但我不确定还能使用什么。

通过使用 ticker = FixedTicker(ticks=[0, 25, 50, 75, 100])

创建我的颜色条解决了这个问题