我想画出某个地铁站每天的出行率。我试着用bokeh作图。当我使用bokeh示例数据时,它工作得很好,但是,当我传递数据时,它会显示空白的bokeh图。在
我正在使用以下代码:from bokeh.io import show
from bokeh.models import (
ColumnDataSource,
HoverTool,
LogColorMapper
)
from bokeh.palettes import Viridis6 as palette
from bokeh.plotting import figure
palette.reverse()
county_xs = stop_frame['latitude'].tolist()
county_ys = stop_frame['longitude'].tolist()
county_names = stop_frame['stop_name'].tolist()
county_rates = stop_frame['Rate'].tolist()
color_mapper = LogColorMapper(palette=palette)
source = ColumnDataSource(data=dict(
x=county_xs,
y=county_ys,
name=county_names,
rate=county_rates,
))
TOOLS = "pan,wheel_zoom,reset,hover,save"
p = figure(
title="Busy Stops of MBTA", tools=TOOLS,
x_axis_location=None, y_axis_location=None
)
p.grid.grid_line_color = 'Red'
p.patches('x', 'y', source=source,
fill_color={'field': 'rate', 'transform': color_mapper},
fill_alpha=0.7, line_color="black", line_width=0.5)
hover = p.select_one(HoverTool)
hover.point_policy = "follow_mouse"
hover.tooltips = [
("Stop Name", "@name"),
("Number", "@rate%"),
("(Long, Lat)", "($x, $y)"),
]
show(p)
我使用以下数据绘制:
^{pr2}$
请告诉我怎样才能看到正确的博克情节