Bokehで表示したグラフの右側にカーソルを当てて表示されるtooltipsの数値表示にeが含まれてしまう。
このeが表示されないようにして、元のdataeに定義されているような数値が表示されるようにしたい。
どなたかご教示していただけると嬉しいです。
from bokeh.plotting import figure, show, ColumnDataSource
from bokeh.models.tools import HoverTool, CustomJSHover
from bokeh.palettes import d3
datae = [[ 0. , 0.12, 0.12, 0.3 , 0. , -0.09, 0.1 , 0.08, 0.06, 0.06, 0.04, 0.03, 0.01, 0. ,
-0.01, 0. , 0. , 0.01, 0. ],[ 0. , 0.06, 0.18, 0.14, 0.05, -0.6 , 0.25, 0.18, 0.12,
0.08, 0.05, 0.06, 0. , 0.04, 0.04, -0.04, 0.05, 0.02,
0.01],[0. , 0.29, 0.12, 0.16, 0.05, 0.2 , 0.19, 0.26, 0.19, 0.34, 0.22,
0.19, 0.11, 0.09, 0.08, 0.05, 0.04, 0.03, 0.02],[ 0. , 0.6 , 0.5 , 0.33, 0.5 , -0.2 , 0.19, 0.3 , 0.3 ,
0.26, 0.12, 0.04, 0.03, 0.04, 0.08, 0.02, 0.03, 0.06,
0.07],[0. , 0.36, 0.36, 0.24, 0.03, 0.06, 0.18, 0.28, 0.16, 0.14, 0.13,
0.15, 0.07, 0.07, 0.06, 0.04, 0.04, 0.04, 0.04],[ 0. , 0.16, 0.3 , 0.13, 0.09, -0.55, 0.21, 0.2 , 0.19,
0.14, 0.07, 0.36, 0.04, 0.14, 0.04, 0.02, 0.02, 0.03,
0.02],[0. , 0.21, 0.26, 0.1 , 0.05, 0.24, 0.15, 0.08, 0.12, 0.12, 0.11,
0.11, 0.08, 0.06, 0.23, 0.06, 0.03, 0.02, 0.02],[0. , 0.4 , 0.17, 0.25, 0.27, 0.5 , 0.08, 0.25, 0.14, 0.23, 0.2 ,
0.17, 0.08, 0.05, 0.09, 0.06, 0.06, 0.13, 0.04]]
g = [ 'T9', 'T14', 'S5', 'S10', 'S15', 'S22', 'S25', 'S30', 'S35', 'S40',
'S45', 'S50', 'S55', 'S60', 'H2', 'H7', 'H12', 'H17', 'H22']
cities = ['Kyoto', 'Kobe', 'Sapporo', 'Kawasaki', 'Fukuoka', 'Hiroshima', 'Sendai', 'Saitama']
colors = d3["Category10"][8]
x_custom = CustomJSHover(code=f'''
const g = {g}
return "" + g[special_vars.segment_index]
''')
p = figure(x_range=g, toolbar_location='right', tools=[HoverTool(formatters={'@x': x_custom})],
sizing_mode='stretch_width',max_width=700, max_height=250,
tooltips="In @x{custom} the population increase rate of @cities is $y",
title='The Population Transition of Japanese City',
x_axis_label='Year in Japanese Calender', y_axis_label='Populationa Increase Rate',
width=800, height=350)
source = ColumnDataSource(data=dict(x=[g]*len(datae), y=datae, color=colors, cities=cities))
p.multi_line(xs='x', ys='y', line_color='color', legend_field='cities', source=source)
p.legend.location = 'center'
p.legend.title = 'The Name of City'
p.legend.title_text_font_style = 'bold'
p.legend.title_text_font_size = '15px'
p.add_layout(p.legend[0], 'right')
show(p)