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)
You can disable scientific notation with this:
fig = plt.figure(title='xxx', x_axis_type='datetime')
fig.left[0].formatter.use_scientific = False
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
To disable the scientific output in Bokeh , use use_scientific
attribute of the formatter you use.
You can find more information regarding use_scientific
attribute here:
use_scientific
attr Example (originaly comes from Bokeh issues discussion ):
from bokeh.models import Axis
yaxis = bar.chart.plot.select(dict(type=Axis, layout="left"))[0]
yaxis.formatter.use_scientific = False
bar.chart.show()
I was trying to turn off scientific notation from a logarithmic axis, and the above answers did not work for me.
I found this: python bokeh plot how to format axis display
In that spirit, this worked for me:
from bokeh.models import BasicTickFormatter
fig = plt.figure(title='xxx', x_axis_type='datetime',y_axis_type='log')
fig.yaxis.formatter = BasicTickFormatter(use_scientific=False)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.