- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我试图绘制特定地铁站每天的出行率。我尝试使用 Bokeh 来绘制它。当我使用 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)
This is the plot I got I want plot like this
我在绘图中使用以下数据:
List of Latitude:
[42.3743352, 42.405219, 42.3487121, 42.3300161, 42.3596754, 42.351771, 42.2834319, 42.360653, 42.3528916, 42.3507067, 42.3307916, 42.3833663, 42.3384306, 42.3492202, 42.33540795, 42.350082, 42.349733, 42.3508198, 42.3613995, 42.3529947, 42.356282, 42.137775, 42.334317, 42.3432487, 42.3105415, 42.3373934, 14.8378415, 42.3611931, 42.9395288, 42.3383404, 42.352444, 42.3405937, 42.3362324, 42.3324596, 42.35215405, 42.3500312, 42.2814234, 42.334912, 42.3551473, 42.32992935, 42.3379418, 42.350675, 42.343451, 42.3340172, 42.3000984, nan, 42.3594924, 42.310412, 42.3487386, 42.36782045, 42.3502301, 42.3578153, 42.3621468, 42.3264153, 42.34712945, nan, nan, 42.322592, nan, 42.3489672, 42.3767055, 42.3683325, 42.336163, 42.336163, 42.3401342, 42.3490087, 42.3691041, 42.3331908, 42.3379387, 42.34315285, 42.33540795, 42.2818516, 42.3652935, 42.3400618, 36.77198965, 42.3912083, 42.3517318, 42.298263, 42.312474, 42.374924, 42.345596, nan, 42.2462086, 42.33511665, 42.400464, 52.985536, 42.3385722, 42.3306533, 42.3366072, nan, 42.3511128, 42.3106539, 42.3667045, 42.293126, 42.35184265, 42.3398175, 42.3588444, 42.317224, 42.39051, 42.3843509, 42.344126, 42.3399846, 42.3426644, 42.289375, 42.3496554, 42.3103337, 42.3484028, 34.1472316, 42.3440373, -41.2932518, 42.2868127, 42.935891, 42.3796991, 42.17368655, 42.3743352, 42.405219, 42.3487121, 42.3300161, 42.3596754, 42.351771, 42.2834319, 42.360653, 42.3528916, 42.3507067, 42.3307916, 42.3833663, 42.3384306, 42.3492202, 42.33540795, 42.350082, 42.349733, 42.3508198, 42.3613995, 42.3529947, 42.356282, 42.137775, 42.334317, 42.3432487, 42.3105415, 42.3373934, 14.8378415, 42.3611931, 42.9395288, 42.3383404, 42.352444, 42.3405937, 42.3362324, 42.3324596, 42.35215405, 42.3500312, 42.2814234, 42.334912, 42.3551473, 42.32992935, 42.3379418, 42.350675, 42.343451, 42.3340172, 42.3000984, nan, 42.3594924, 42.310412, 42.3487386, 42.36782045, 42.3502301, 42.3578153, 42.3621468, 42.3264153, 42.34712945, nan, nan, 42.322592, nan, 42.3489672, 42.3767055, 42.3683325, 42.336163, 42.336163, 42.3401342, 42.3490087, 42.3691041, 42.3331908, 42.3379387, 42.34315285, 42.33540795, 42.2818516, 42.3652935, 42.3400618, 36.77198965, 42.3912083, 42.3517318, 42.298263, 42.312474, 42.374924, 42.345596, nan, 42.2462086, 42.33511665, 42.400464, 52.985536, 42.3385722, 42.3306533, 42.3366072, nan, 42.3511128, 42.3106539, 42.3667045, 42.293126, 42.35184265, 42.3398175, 42.3588444, 42.317224, 42.39051, 42.3843509, 42.344126, 42.3399846, 42.3426644, 42.289375, 42.3496554, 42.3103337, 42.3484028, 34.1472316, 42.3440373, -41.2932518, 42.2868127, 42.935891, 42.3796991, 42.17368655, 42.3743352, 42.405219, 42.3487121, 42.3300161, 42.3596754, 42.351771, 42.2834319, 42.360653, 42.3528916, 42.3507067, 42.3307916, 42.3833663, 42.3384306, 42.3492202, 42.33540795, 42.350082, 42.349733, 42.3508198, 42.3613995, 42.3529947, 42.356282, 42.137775, 42.334317, 42.3432487, 42.3105415, 42.3373934, 14.8378415, 42.3611931, 42.9395288, 42.3383404, 42.352444, 42.3405937, 42.3362324, 42.3324596, 42.35215405, 42.3500312, 42.2814234, 42.334912, 42.3551473, 42.32992935, 42.3379418, 42.350675, 42.343451, 42.3340172, 42.3000984, nan, 42.3594924, 42.310412, 42.3487386, 42.36782045, 42.3502301, 42.3578153, 42.3621468, 42.3264153, 42.34712945, nan, nan, 42.322592, nan, 42.3489672, 42.3767055, 42.3683325, 42.336163, 42.336163, 42.3401342, 42.3490087, 42.3691041, 42.3331908, 42.3379387, 42.34315285, 42.33540795, 42.2818516, 42.3652935, 42.3400618, 36.77198965, 42.3912083, 42.3517318, 42.298263, 42.312474, 42.374924, 42.345596, nan, 42.2462086, 42.33511665, 42.400464, 52.985536, 42.3385722, 42.3306533, 42.3366072, nan, 42.3511128, 42.3106539, 42.3667045, 42.293126, 42.35184265, 42.3398175, 42.3588444, 42.317224, 42.39051, 42.3843509, 42.344126, 42.3399846, 42.3426644, 42.289375, 42.3496554, 42.3103337, 42.3484028, 34.1472316, 42.3440373, -41.2932518, 42.2868127, 42.935891, 42.3796991, 42.17368655]
<class 'list'>
List of Longitude:
[-71.0302838, -71.1345529, -71.137998, -71.0571473, -71.051589, -71.0709689, -71.0689392, -71.0669956, -71.1210369, -71.0797296, -71.1115857, -71.0014859, -71.1419973, -71.1000476, -71.16774026628, -71.1071825, -71.1043086, -71.1133692, -71.0619579, -71.0646277, -71.1352739, -72.5144729, -71.1043559, -71.057556, -71.114418, -71.105677862353, 120.8811589, -71.07134, -71.6181266, -71.1528793, -71.0625269, -71.150998, -71.1489684, -71.0918985, -71.1177049872685, -71.0774698, -71.0480849, -71.0260169, -71.0599538, -71.0908218455712, -71.1486134, -71.1629499, -71.0977163, -71.1059925, -71.057828, nan, -71.059303, -71.1075565, -71.1341589, -71.1266617287448, -71.1314227, -71.0561654, -71.0577938, -71.1007881, -71.0840042393235, nan, nan, -71.1002459, nan, -71.0956556, -71.0577890740004, -71.0747495, -71.0995139, -71.0995139, -71.0684271, -71.0885813, -71.0395763, -71.1095969, -71.0949801, -71.1619761802168, -71.16774026628, -71.0420034, -71.0601295, -71.0896922, -76.2292380281969, -71.0069943, -71.1253311, -71.0619959, -71.0589269, -71.0389389, -71.0813609, nan, -71.0048427, -71.158337534632, -70.9968109, -0.0337584, -71.110953166015, -71.0911626, -71.0893383, nan, -71.1157856, -71.0494946, -71.0677683, -71.0657379, -71.0550227973888, -71.1575631, -71.0572151, -71.1042799, -70.9971874, -71.0769705, -71.1382459, -71.1482657, -71.0848335, -71.1324559, -71.0638504, -71.2366332, -71.1404181, -118.1308664, -71.1426297, 174.7830529, -71.0830768, -81.2798437, -71.0228171, -83.3897170437666, -71.0302838, -71.1345529, -71.137998, -71.0571473, -71.051589, -71.0709689, -71.0689392, -71.0669956, -71.1210369, -71.0797296, -71.1115857, -71.0014859, -71.1419973, -71.1000476, -71.16774026628, -71.1071825, -71.1043086, -71.1133692, -71.0619579, -71.0646277, -71.1352739, -72.5144729, -71.1043559, -71.057556, -71.114418, -71.105677862353, 120.8811589, -71.07134, -71.6181266, -71.1528793, -71.0625269, -71.150998, -71.1489684, -71.0918985, -71.1177049872685, -71.0774698, -71.0480849, -71.0260169, -71.0599538, -71.0908218455712, -71.1486134, -71.1629499, -71.0977163, -71.1059925, -71.057828, nan, -71.059303, -71.1075565, -71.1341589, -71.1266617287448, -71.1314227, -71.0561654, -71.0577938, -71.1007881, -71.0840042393235, nan, nan, -71.1002459, nan, -71.0956556, -71.0577890740004, -71.0747495, -71.0995139, -71.0995139, -71.0684271, -71.0885813, -71.0395763, -71.1095969, -71.0949801, -71.1619761802168, -71.16774026628, -71.0420034, -71.0601295, -71.0896922, -76.2292380281969, -71.0069943, -71.1253311, -71.0619959, -71.0589269, -71.0389389, -71.0813609, nan, -71.0048427, -71.158337534632, -70.9968109, -0.0337584, -71.110953166015, -71.0911626, -71.0893383, nan, -71.1157856, -71.0494946, -71.0677683, -71.0657379, -71.0550227973888, -71.1575631, -71.0572151, -71.1042799, -70.9971874, -71.0769705, -71.1382459, -71.1482657, -71.0848335, -71.1324559, -71.0638504, -71.2366332, -71.1404181, -118.1308664, -71.1426297, 174.7830529, -71.0830768, -81.2798437, -71.0228171, -83.3897170437666, -71.0302838, -71.1345529, -71.137998, -71.0571473, -71.051589, -71.0709689, -71.0689392, -71.0669956, -71.1210369, -71.0797296, -71.1115857, -71.0014859, -71.1419973, -71.1000476, -71.16774026628, -71.1071825, -71.1043086, -71.1133692, -71.0619579, -71.0646277, -71.1352739, -72.5144729, -71.1043559, -71.057556, -71.114418, -71.105677862353, 120.8811589, -71.07134, -71.6181266, -71.1528793, -71.0625269, -71.150998, -71.1489684, -71.0918985, -71.1177049872685, -71.0774698, -71.0480849, -71.0260169, -71.0599538, -71.0908218455712, -71.1486134, -71.1629499, -71.0977163, -71.1059925, -71.057828, nan, -71.059303, -71.1075565, -71.1341589, -71.1266617287448, -71.1314227, -71.0561654, -71.0577938, -71.1007881, -71.0840042393235, nan, nan, -71.1002459, nan, -71.0956556, -71.0577890740004, -71.0747495, -71.0995139, -71.0995139, -71.0684271, -71.0885813, -71.0395763, -71.1095969, -71.0949801, -71.1619761802168, -71.16774026628, -71.0420034, -71.0601295, -71.0896922, -76.2292380281969, -71.0069943, -71.1253311, -71.0619959, -71.0589269, -71.0389389, -71.0813609, nan, -71.0048427, -71.158337534632, -70.9968109, -0.0337584, -71.110953166015, -71.0911626, -71.0893383, nan, -71.1157856, -71.0494946, -71.0677683, -71.0657379, -71.0550227973888, -71.1575631, -71.0572151, -71.1042799, -70.9971874, -71.0769705, -71.1382459, -71.1482657, -71.0848335, -71.1324559, -71.0638504, -71.2366332, -71.1404181, -118.1308664, -71.1426297, 174.7830529, -71.0830768, -81.2798437, -71.0228171, -83.3897170437666]
<class 'list'>
List of stop name:
['Airport , Boston', 'Alewife, Boston', 'Allston Street , Boston', 'Andrew , Boston', 'Aquarium , Boston', 'Arlington , Boston', 'Ashmont , Boston', 'Assembly , Boston', 'Babcock Street , Boston', 'Back Bay , Boston', 'Back of the Hill , Boston', 'Beachmont , Boston', 'Beaconsfield , Boston', 'Blandford Street , Boston', 'Boston College , Boston', 'Boston Univ Central , Boston', 'Boston Univ East , Boston', 'Boston Univ West , Boston', 'Bowdoin, Boston', 'Boylston , Boston', 'Braintree, Boston', 'Brandon Hall , Boston', 'Brigham Circle , Boston', 'Broadway , Boston', 'Brookline Hills , Boston', 'Brookline Village , Boston', 'Central , Boston', 'Charles/MGH , Boston', 'Chestnut Hill , Boston', 'Chestnut Hill Avenue , Boston', 'Chinatown , Boston', 'Chiswick Road , Boston', 'Cleveland Circle , Boston', 'Community College , Boston', 'Coolidge Corner , Boston', 'Copley , Boston', 'Davis , Boston', 'Dean Road , Boston', 'Downtown Crossing , Boston', 'Eliot , Boston', 'Englewood Avenue , Boston', 'Fairbanks Street , Boston', 'Fenway , Boston', 'Fenwood Road , Boston', 'Fields Corner , Boston', 'Forest Hills Orange Line, Boston', 'Government Center , Boston', 'Green Street , Boston', 'Griggs Street , Boston', 'Harvard , Boston', 'Harvard Avenue , Boston', 'Hawes Street , Boston', 'Haymarket , Boston', 'Heath Street , Boston', 'Hynes , Boston', 'JFK/UMASS Ashmont , Boston', 'JFK/UMASS Braintree , Boston', 'Jackson Square , Boston', 'Kendall/MIT , Boston', 'Kenmore , Boston', 'Kent Street , Boston', 'Lechmere , Boston', 'Longwood , Boston', 'Longwood Medical Area , Boston', 'Malden , Boston', 'Massachusetts Avenue , Boston', 'Maverick , Boston', 'Mission Park , Boston', 'Museum of Fine Arts , Boston', 'Newton Centre , Boston', 'Newton Highlands , Boston', 'North Quincy , Boston', 'North Station , Boston', 'Northeastern , Boston', 'Oak Grove, Boston', 'Orient Heights , Boston', 'Packards Corner , Boston', 'Park Street , Boston', 'Pleasant Street , Boston', 'Porter , Boston', 'Prudential , Boston', 'Quincy Adams , Boston', 'Quincy Center , Boston', 'Reservoir , Boston', 'Revere Beach , Boston', 'Riverside , Boston', 'Riverway , Boston', 'Roxbury Crossing , Boston', 'Ruggles , Boston', 'Saint Mary Street , Boston', 'Saint Paul Street , Boston', 'Savin Hill , Boston', 'Science Park , Boston', 'Shawmut , Boston', 'South Station , Boston', 'South Street , Boston', 'State Street , Boston', 'Stony Brook , Boston', 'Suffolk Downs , Boston', 'Sullivan Square , Boston', 'Summit Avenue , Boston', 'Sutherland Road , Boston', 'Symphony , Boston', 'Tappan Street , Boston', 'Tufts Medical Center , Boston', 'Waban , Boston', 'Warren Street , Boston', 'Washington Square , Boston', 'Washington Street , Boston', 'Wellington , Boston', 'Wollaston , Boston', 'Wonderland, Boston', 'Wood Island , Boston', 'Woodland , Boston', 'Airport , Boston', 'Alewife, Boston', 'Allston Street , Boston', 'Andrew , Boston', 'Aquarium , Boston', 'Arlington , Boston', 'Ashmont , Boston', 'Assembly , Boston', 'Babcock Street , Boston', 'Back Bay , Boston', 'Back of the Hill , Boston', 'Beachmont , Boston', 'Beaconsfield , Boston', 'Blandford Street , Boston', 'Boston College , Boston', 'Boston Univ Central , Boston', 'Boston Univ East , Boston', 'Boston Univ West , Boston', 'Bowdoin, Boston', 'Boylston , Boston', 'Braintree, Boston', 'Brandon Hall , Boston', 'Brigham Circle , Boston', 'Broadway , Boston', 'Brookline Hills , Boston', 'Brookline Village , Boston', 'Central , Boston', 'Charles/MGH , Boston', 'Chestnut Hill , Boston', 'Chestnut Hill Avenue , Boston', 'Chinatown , Boston', 'Chiswick Road , Boston', 'Cleveland Circle , Boston', 'Community College , Boston', 'Coolidge Corner , Boston', 'Copley , Boston', 'Davis , Boston', 'Dean Road , Boston', 'Downtown Crossing , Boston', 'Eliot , Boston', 'Englewood Avenue , Boston', 'Fairbanks Street , Boston', 'Fenway , Boston', 'Fenwood Road , Boston', 'Fields Corner , Boston', 'Forest Hills Orange Line, Boston', 'Government Center , Boston', 'Green Street , Boston', 'Griggs Street , Boston', 'Harvard , Boston', 'Harvard Avenue , Boston', 'Hawes Street , Boston', 'Haymarket , Boston', 'Heath Street , Boston', 'Hynes , Boston', 'JFK/UMASS Ashmont , Boston', 'JFK/UMASS Braintree , Boston', 'Jackson Square , Boston', 'Kendall/MIT , Boston', 'Kenmore , Boston', 'Kent Street , Boston', 'Lechmere , Boston', 'Longwood , Boston', 'Longwood Medical Area , Boston', 'Malden , Boston', 'Massachusetts Avenue , Boston', 'Maverick , Boston', 'Mission Park , Boston', 'Museum of Fine Arts , Boston', 'Newton Centre , Boston', 'Newton Highlands , Boston', 'North Quincy , Boston', 'North Station , Boston', 'Northeastern , Boston', 'Oak Grove, Boston', 'Orient Heights , Boston', 'Packards Corner , Boston', 'Park Street , Boston', 'Pleasant Street , Boston', 'Porter , Boston', 'Prudential , Boston', 'Quincy Adams , Boston', 'Quincy Center , Boston', 'Reservoir , Boston', 'Revere Beach , Boston', 'Riverside , Boston', 'Riverway , Boston', 'Roxbury Crossing , Boston', 'Ruggles , Boston', 'Saint Mary Street , Boston', 'Saint Paul Street , Boston', 'Savin Hill , Boston', 'Science Park , Boston', 'Shawmut , Boston', 'South Station , Boston', 'South Street , Boston', 'State Street , Boston', 'Stony Brook , Boston', 'Suffolk Downs , Boston', 'Sullivan Square , Boston', 'Summit Avenue , Boston', 'Sutherland Road , Boston', 'Symphony , Boston', 'Tappan Street , Boston', 'Tufts Medical Center , Boston', 'Waban , Boston', 'Warren Street , Boston', 'Washington Square , Boston', 'Washington Street , Boston', 'Wellington , Boston', 'Wollaston , Boston', 'Wonderland, Boston', 'Wood Island , Boston', 'Woodland , Boston', 'Airport , Boston', 'Alewife, Boston', 'Allston Street , Boston', 'Andrew , Boston', 'Aquarium , Boston', 'Arlington , Boston', 'Ashmont , Boston', 'Assembly , Boston', 'Babcock Street , Boston', 'Back Bay , Boston', 'Back of the Hill , Boston', 'Beachmont , Boston', 'Beaconsfield , Boston', 'Blandford Street , Boston', 'Boston College , Boston', 'Boston Univ Central , Boston', 'Boston Univ East , Boston', 'Boston Univ West , Boston', 'Bowdoin, Boston', 'Boylston , Boston', 'Braintree, Boston', 'Brandon Hall , Boston', 'Brigham Circle , Boston', 'Broadway , Boston', 'Brookline Hills , Boston', 'Brookline Village , Boston', 'Central , Boston', 'Charles/MGH , Boston', 'Chestnut Hill , Boston', 'Chestnut Hill Avenue , Boston', 'Chinatown , Boston', 'Chiswick Road , Boston', 'Cleveland Circle , Boston', 'Community College , Boston', 'Coolidge Corner , Boston', 'Copley , Boston', 'Davis , Boston', 'Dean Road , Boston', 'Downtown Crossing , Boston', 'Eliot , Boston', 'Englewood Avenue , Boston', 'Fairbanks Street , Boston', 'Fenway , Boston', 'Fenwood Road , Boston', 'Fields Corner , Boston', 'Forest Hills Orange Line, Boston', 'Government Center , Boston', 'Green Street , Boston', 'Griggs Street , Boston', 'Harvard , Boston', 'Harvard Avenue , Boston', 'Hawes Street , Boston', 'Haymarket , Boston', 'Heath Street , Boston', 'Hynes , Boston', 'JFK/UMASS Ashmont , Boston', 'JFK/UMASS Braintree , Boston', 'Jackson Square , Boston', 'Kendall/MIT , Boston', 'Kenmore , Boston', 'Kent Street , Boston', 'Lechmere , Boston', 'Longwood , Boston', 'Longwood Medical Area , Boston', 'Malden , Boston', 'Massachusetts Avenue , Boston', 'Maverick , Boston', 'Mission Park , Boston', 'Museum of Fine Arts , Boston', 'Newton Centre , Boston', 'Newton Highlands , Boston', 'North Quincy , Boston', 'North Station , Boston', 'Northeastern , Boston', 'Oak Grove, Boston', 'Orient Heights , Boston', 'Packards Corner , Boston', 'Park Street , Boston', 'Pleasant Street , Boston', 'Porter , Boston', 'Prudential , Boston', 'Quincy Adams , Boston', 'Quincy Center , Boston', 'Reservoir , Boston', 'Revere Beach , Boston', 'Riverside , Boston', 'Riverway , Boston', 'Roxbury Crossing , Boston', 'Ruggles , Boston', 'Saint Mary Street , Boston', 'Saint Paul Street , Boston', 'Savin Hill , Boston', 'Science Park , Boston', 'Shawmut , Boston', 'South Station , Boston', 'South Street , Boston', 'State Street , Boston', 'Stony Brook , Boston', 'Suffolk Downs , Boston', 'Sullivan Square , Boston', 'Summit Avenue , Boston', 'Sutherland Road , Boston', 'Symphony , Boston', 'Tappan Street , Boston', 'Tufts Medical Center , Boston', 'Waban , Boston', 'Warren Street , Boston', 'Washington Square , Boston', 'Washington Street , Boston', 'Wellington , Boston', 'Wollaston , Boston', 'Wonderland, Boston', 'Wood Island , Boston', 'Woodland , Boston']
<class 'list'>
List of Rate of trips/day:
[8.8, 8.8, 8.8, 8.8, 8.8, 35.1, 3.5, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 35.1, 5.3, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 35.1, 8.8, 8.8, 17.5, 8.8, 8.8, 8.8, 8.8, 8.8, 3.5, 8.8, 35.1, 8.8, 8.8, 8.8, 8.8, 8.8, 26.3, 8.8, 26.3, 3.5, 5.3, 8.8, 8.8, 26.3, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 5.3, 26.3, 8.8, 8.8, 8.8, 8.8, 43.9, 8.8, 8.8, 8.8, 5.3, 5.3, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 17.5, 3.5, 8.8, 3.5, 8.8, 8.8, 17.5, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 5.3, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 35.1, 4.4, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 35.1, 4.4, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 35.1, 8.8, 8.8, 17.5, 8.8, 8.8, 8.8, 8.8, 8.8, 4.4, 8.8, 36.8, 8.8, 8.8, 8.8, 8.8, 8.8, 28.1, 8.8, 26.3, 4.4, 4.4, 8.8, 8.8, 26.3, 8.8, 12.3, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 4.4, 28.1, 8.8, 8.8, 8.8, 8.8, 43.9, 8.8, 8.8, 8.8, 4.4, 4.4, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 17.5, 4.4, 12.3, 4.4, 8.8, 8.8, 17.5, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 4.4, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 35.1, 4.4, 8.8, 8.8, 8.8, 8.8, 7.9, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 35.1, 4.4, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 7.9, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 35.1, 8.8, 8.8, 17.5, 7.9, 8.8, 8.8, 8.8, 8.8, 4.4, 8.8, 35.1, 8.8, 8.8, 8.8, 8.8, 8.8, 26.3, 8.8, 26.3, 4.4, 4.4, 8.8, 8.8, 26.3, 8.8, 12.3, 8.8, 8.8, 7.9, 8.8, 8.8, 8.8, 8.8, 7.9, 7.9, 4.4, 26.3, 8.8, 7.9, 8.8, 8.8, 43.9, 8.8, 8.8, 8.8, 4.4, 4.4, 8.8, 7.9, 7.9, 8.8, 8.8, 8.8, 8.8, 17.5, 4.4, 12.3, 4.4, 8.8, 8.8, 17.5, 8.8, 7.9, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 7.9, 8.8, 8.8, 8.8, 8.8, 4.4, 7.9, 8.8, 7.9]
<class 'list'>
请建议我如何查看正确的 Bokeh 图
最佳答案
尝试运行您的示例时我注意到两个问题:
尝试绘制缺失值时会出现错误,要消除它们,您可以使用
stop_frame.dropna(inplace=True)
或者使用一些合理的默认值填充它们
stop_frame.fillna(0, inplace=True)
您的纬度
和经度
坐标只是标量值。在 texas示例(您正在修改)lats
和 longs
由定义县边界的 float 列表组成。
因此,尝试使用 patches
(需要列表列表)会抛出JS 控制台中的错误无法设置初始范围...
将其修正为patch
仍然无法填充面部在
fill_color
选项中传递一个字典 p.patch('x', 'y', source=source,
fill_color={'field': 'rate', 'transform': color_mapper},
fill_alpha=0.7, line_color="black", line_width=0.5)
将其更改为 fill_color='blue'
将绘制线条连接您的站点。
更好的解决方案是使用scatter
或circle
,即
p.circle('x', 'y', source=source,
fill_color={'field': 'rate', 'transform': color_mapper},
fill_alpha=0.7, line_color= 'black', line_width=0.5)
更好的是,您可以使用速率的对数来缩放圆半径(或其他一些功能)
source = ColumnDataSource(data=dict(
x=county_xs,
y=county_ys,
name=county_names,
rate=county_rates,
log_rate=np.log(county_rates),
))
...
p.circle('x', 'y', source=source,
radius='log_rate',
fill_color={'field': 'rate', 'transform': color_mapper},
fill_alpha=0.7, line_color= 'black', line_width=0.5)
编辑:回答评论中的问题。您可以通过修改德克萨斯州的示例来绘制马萨诸塞州的县。您可以在绘制止损点之前轻松插入这段代码。
from bokeh.sampledata.us_counties import data as counties
ma_counties = {
code: county for code, county in counties.items() if county["state"] == "ma"
}
ma_county_xs = [county["lats"] for county in ma_counties.values()]
ma_county_ys = [county["lons"] for county in ma_counties.values()]
ma_county_names = [county['name'] for county in ma_counties.values()]
ma_source = ColumnDataSource(data=dict(
x=ma_county_xs,
y=ma_county_ys,
name=ma_county_names
))
p.patches('x', 'y', source=ma_source,
fill_color='gray',
fill_alpha=0.7, line_color= 'black', line_width=0.5)
注意:根据您的设置,您需要放大才能查看 map ,因为您的列表中几乎没有异常站点。
关于python - 在 map Bokeh 上执行面积图时,它显示空白框并且不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43440890/
我用 bokeh.plotting.Figure.line 画了下面的图。我如何添加垂直引用线来强调 Feb/14 的一个点? 这是另一个情节。这是 bokeh.charts.Bar。我想添加水平指南
我使用 python 在 Bokeh 中创建了一个散点图。我想创建一个小部件,允许用户更改散点图中点的颜色。有没有简单的方法可以做到这一点?我找到了一个基于 JQuery 的颜色选择器小部件 ( ht
我有一个 bokeh 应用程序,我可以在其中读取各种文件(6 到 12 个)并生成 DataTable 来比较几个不同的变量。 所以我有一个生成 DataTable 的循环,将它们添加到列表中,然后最
典型的 Bokeh 散点图可能如下所示: 其中 x 和 y 限制均为 [0,1]。如何删除轴上 0 之前并延伸到 1 之外的额外空间?这样最终图的左角为坐标 (0,0),左上角和右下角分别为 (0,1
我正在尝试创建一个 Bokeh 图,它允许我通过单击复选框来切换图中线条的可见性。 我开始尝试对复选框组使用 js 回调,但不幸的是,实际上并没有为复选框组实现 js 回调。 任何人都可以提出另一种方
例如,我有 button = Button(label="0", type="success") 选择此按钮后,我想将标签更改为“1”,反之亦然。有没有简单的方法来实现这一目标? 编辑: RadioB
我团队中的一些人,包括我自己,发现在 Bokeh 散点图中使用 circle 非常令人迷惑。方法,对于图中数据的初始自动缩放拟合,我们可以为我们的数据拨入合理的大小,例如使用 plot.circle(
所以我想做的是一个带有线条和圆圈的简单图形 http://docs.bokeh.org/en/latest/docs/quickstart.html#getting-started 但带有在鼠标悬停在
考虑一个垂直堆积条形图,其中每一列都由多个条形(段)组成。是否可以在每个段上添加工具提示?目前,相同的工具提示附加到组成该列的所有段。 from bokeh.core.properties impor
In[21]: from bokeh.charts import Bar, output_file, show In[22]: dict = {'sec': {u'A': 10, u'B': 20}}
在 Bokeh 中实现树形图需要什么?类似于这个 DS 示例的东西会很好—— http://bl.ocks.org/robschmuecker/7880033 我只是想可视化一个数据结构,所以只需要平
我了解如何指定在 Bokeh 中显示的特定刻度,但我的问题是是否有一种方法可以分配特定的标签来显示与位置。例如 plot.xaxis[0].ticker=FixedTicker(ticks=[0,1]
有什么方法可以为图例添加标题,例如左侧为当前图例,右侧为带有标题的图例。这个特殊的图例被放置在情节之外,所以我不知道是否可以用文本字形来伪造它。 最佳答案 从最新版本的 Bokeh (1.2) 开始,
问题:我的 python 应用程序启动了一个 Bokeh 服务器,如本文所述: http://matthewrocklin.com/blog/work/2017/06/28/simple-bokeh-
我正在使用 Bokeh 图制作折线图,我想标记实际的点(用线穿过它们),而不是仅仅标记线本身。我怎样才能做到这一点?我浏览了文档和用户指南,但似乎找不到答案。谢谢! 最佳答案 假设您正在使用 boke
我将一个 Bokeh Figure 实例作为输入传递给另一个函数,我需要在那里修改它的源代码。 不知道该怎么做! 这就是我创建图形实例的方式: source = ColumnDataSource({'
据我所知,我可以通过设置 responsive=True 来使 Bokeh 图响应 div 的宽度。然而,我感兴趣的是让 Bokeh 图只在一定程度上做出响应。有没有一种方法可以让我设置 Bokeh
我有一个 Bokeh 服务器应用程序。我想在命令行上传递自定义选项: bokeh serve /path/to/script.py --my-option foo 这可能吗? Bokeh 会以某种方式
我有一个图,它使用来自一些原始数据的值(在 0-20 的 x/y 范围内),以及一些导致一些相当大的 x/y 值(例如 -1000 到 1000+)的最小化数据。因此,我所做的绘图需要我手动单击缩放以
在Web应用程序中,我想让用户使用bokeh的漂亮的框/套索选择工具来选择绘制图像中的感兴趣区域。我想接收选定的像素,以便在python中进行进一步的操作。 对于散点图,这类似于gallery,很容易
我是一名优秀的程序员,十分优秀!