python bokeh bokeh如何格式化轴显示 [英] python bokeh plot how to format axis display

查看:181
本文介绍了python bokeh bokeh如何格式化轴显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

y轴刻度似乎是格式化数字,如500000000至5.000e + 8.有没有一种方法可以控制显示,使其显示为500000000?

the y axis ticks seem to be formatting numbers like 500000000 to 5.000e+8. Is there a way to control the display so that it displays as 500000000?

使用python 2.7,散景0.5.2

using python 2.7, bokeh 0.5.2

我正在bokeh教程页面上尝试时间序列示例

i m trying out the timeseries example at bokeh tutorials page

本教程将"Adj Close"与"Date"相对应,但我将"Volume"与"Date"相对应

The tutorial plots 'Adj Close' against 'Date' but i'm plotting with 'Volume' against 'Date'

推荐答案

您还可以使用下面的玩具图中使用的NumeralTickFormatter.在此处.

You can also use NumeralTickFormatter as used in the toy plot below. The other possible values in place of '00' are listed here.

import pandas as pd
import numpy as np
from bokeh.plotting import figure, output_file, show
from bokeh.models import NumeralTickFormatter

df = pd.DataFrame(np.random.randint(0, 90000000000, (10,1)), columns=['my_int'])
p = figure(plot_width=700, plot_height=280, y_range=[0,100000000000])
output_file("toy_plot_with_commas")

for index, record in df.iterrows():
    p.rect([index], [record['my_int']/2], 0.8, [record['my_int']], fill_color="red", line_color="black")

p.yaxis.formatter=NumeralTickFormatter(format="00")
show(p)

这篇关于python bokeh bokeh如何格式化轴显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆