Reputation: 535
With NumeralTickFormatter(format='0,0')
I was able to get comma as thousands separator for example but I couldn't find a way to use a space.
I also tried to use the language='fi'
parameter but that didn't seem to help or I used it the wrong way.
Upvotes: 3
Views: 1389
Reputation: 34618
As far as I know the built in NumeralTickFormatter
does not support this, since the underlying third party JavaScript library that it is built on does not have any mode to display with spaces. However, Bokeh has a FuncTickFormatter that allows you to provide your own JS snippet to do whatever formatting you like:
from bokeh.models import FuncTickFormatter
from bokeh.plotting import figure, show, output_file
output_file("formatter.html")
p = figure(plot_width=500, plot_height=500)
p.circle([0, 10], [10, 1000000], size=30)
p.yaxis.formatter = FuncTickFormatter(code="""
parts = tick.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, " ");
return parts.join(".");
""")
show(p)
Results in:
Upvotes: 8