Search code examples
pythonbokeh

Set custom tick labels Bokeh


I want to have tick marks at 0, 25, 50, 75, and 100, so I defined them as this.

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
                    )

This only overwrites the 0 and 100 label, and everything else (20, 40, etc) has its default label. How do I fix this? My guess is that I shouldn't be doing major label overrides, but I'm not sure what else to use.


Solution

  • solved it by creating my colorbar with ticker = FixedTicker(ticks=[0, 25, 50, 75, 100])