Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable scientific notation on axes using Bokeh

Tags:

How can you disable scientific output of numbers on an axis in bokeh? For example, I want 400000 and not 4.00e+5

In mpl: ax.get_xaxis().get_major_formatter().set_scientific(False)

like image 648
quasiben Avatar asked Jul 02 '14 15:07

quasiben


Video Answer


2 Answers

You can disable scientific notation with this:

fig = plt.figure(title='xxx', x_axis_type='datetime') fig.left[0].formatter.use_scientific = False 
like image 96
korst1k Avatar answered Oct 18 '22 01:10

korst1k


Note that as of Bokeh v0.9.1, Marek's answer will no longer work due to changes in the interface for Charts. The following code (from GitHub) is a fully-functional example of how to turn off scientific notation in a high level chart.

from bokeh.embed import components from bokeh.models import Axis from bokeh.charts import Bar data = {"y": [6, 7, 2, 4, 5], "z": [1, 5, 12, 4, 2]} bar = Bar(data) yaxis = bar.select(dict(type=Axis, layout="left"))[0] yaxis.formatter.use_scientific = False script, div = components(bar) print(script) print(div) 

The key lines are:

yaxis = bar.select(dict(type=Axis, layout="left"))[0] yaxis.formatter.use_scientific = False 
like image 23
Josh Sherick Avatar answered Oct 18 '22 02:10

Josh Sherick