Axis Label Multi-color

I was looking thru the documentation: Styling Axes

Based on what I know about bokeh, I doubt this is possible, but I want to color the Labels of a Categorical x-axis different colors. Something like the below:

# Set the major labels of the X-axis to a list or colormap
p.xaxis.major_label_text_color = ['red', 'green','blue']

Is there a way to do this?

Not presently, tick styling properties currently apply to all ticks on an axis. It seems there was a related discussion raised about this in the past but it never saw any movement

Got it, thank you. It was a hopeful shot in the dark…given the number of times it’s been raised it is very unimportant.

In case anyone stumbles upon this thread later and is wondering, I did find a workaround.
Remove the x-axis entirely (xaxis.visible=False) and make a replacement axis/labels using a LabelSet (or text glyphs), a Line glyph for the axis itself, etc. Clunky, but does the trick.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.