☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Escaping Characters on RangeSlider 'format'

Community Supportbokeh
Gen
Gen

I tried searching in the documentation but didn’t get anywhere with this question.
What “format standard” is the format option for RangeSlider?

yield_slider = RangeSlider(
            start=0.1, 
            end=5,
            value=(0.1, 5),
            format='0.00 \%',
            title="Yield"
)

I’m trying to get:
0.10%..5.00%

However, format takes ‘%’ and formats it as a percentage so I get:
10%..500%

What is the correct way to escape special characters like the percent symbol?
I’ve tried the obvious ones ‘%%’ and ‘%’ to no avail.

⌁   Link to post
Bryan
Bryan

By default, ranges use the NumeralTickFormatter, which documents all of its formats in the reference guide: formatters — Bokeh 3.2.0 Documentation

Under the covers, NumeralTickFormatter just passes everthing to a JavaScript library numbro.js. Looking at their docs, I am not sure that any escaping is supported.

However, besides format strings, you can pass any actual tick formatter objects, e.g. a PrintfTickFormatter might be a better choice here:

https://docs.bokeh.org/en/latest/docs/user_guide/styling/plots.html#tick-label-formats

⌁   Link to post
Gen
Gen

So I think we can close this except for one note for people looking at this thread later.
Just due to the limitations of PrintfTickFormatter and NumeralTickFormatter, if you want to escape a character AND use the thousands separator, I don’t think there is a supported way to print this.

For example, if you want 2560 to become 2,560 minutes you’ll either have to go with:

NumeralTickFormatter(format='0,000')="2,560"
PrintfTickFormatter(format='%.0f minutes') = "2560 minutes"

So in this rare case, making a custom class might be necessary.

⌁   Link to post

End of archived discussion · Replies are disabled