当前位置: 首页>>代码示例>>Python>>正文


Python GMapPlot.plot_width方法代码示例

本文整理汇总了Python中bokeh.models.GMapPlot.plot_width方法的典型用法代码示例。如果您正苦于以下问题:Python GMapPlot.plot_width方法的具体用法?Python GMapPlot.plot_width怎么用?Python GMapPlot.plot_width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bokeh.models.GMapPlot的用法示例。


在下文中一共展示了GMapPlot.plot_width方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_heatmap

# 需要导入模块: from bokeh.models import GMapPlot [as 别名]
# 或者: from bokeh.models.GMapPlot import plot_width [as 别名]
def create_heatmap(station_scores, plot_width=1000, plot_height=600):
    map_options = GMapOptions(lat=32.06, lng=34.87, map_type="roadmap", zoom=9)
    cmap = plt.get_cmap('jet')
    plot = GMapPlot(
        x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options, title="Israel"
    )
    plot.plot_width = plot_width
    plot.plot_height = plot_height
    lat_vec = list(map(lambda x: get_loc_by_id(x).lat, station_scores.keys()))
    lon_vec = list(map(lambda x: get_loc_by_id(x).lon, station_scores.keys()))

    for ind, station in enumerate(station_scores):

        source = ColumnDataSource(
            data=dict(
                lat=[lat_vec[ind]],
                lon=[lon_vec[ind]],
            )
        )
        cmap_indx = int(station_scores[station]*cmap.N)
        cmap_val = tuple(np.floor(255 * np.array(cmap(cmap_indx)[:3])))
        circle = Circle(x="lon", y="lat", size=17, fill_color=cmap_val, fill_alpha=0.95, line_color=None)
        plot.add_glyph(source, circle)

    plot.add_tools(PanTool(), WheelZoomTool())
    output_file("Mean Time to Tel-Aviv Hashalom.html")
    show(plot)
开发者ID:hasadna,项目名称:OpenTrainCommunity,代码行数:29,代码来源:heatmap.py

示例2: open

# 需要导入模块: from bokeh.models import GMapPlot [as 别名]
# 或者: from bokeh.models.GMapPlot import plot_width [as 别名]
#     https://developers.google.com/maps/documentation/javascript/get-api-key
#
# Replace the value below with your personal API key:
plot.api_key = API_KEY


with open("incidents.json") as f:
    incidents = json.load(f)

pts = [x['point']['coordinates'] for x in incidents]

source = ColumnDataSource(
    data=dict(
        lat=[x[0] for x in pts],
        lon=[x[1] for x in pts],
    )
)

circle = Circle(x="lon", y="lat", size=15, fill_color="blue", fill_alpha=0.8, line_color=None)
plot.add_glyph(source, circle)

plot.plot_height = 700
plot.plot_width = 700
#plot.add_tools(PanTool(), WheelZoomTool())

plot.min_border = 0


output_file("gmap_plot.html")
show(plot)
开发者ID:clarkfitzg,项目名称:junkyard,代码行数:32,代码来源:maps.py

示例3: index

# 需要导入模块: from bokeh.models import GMapPlot [as 别名]
# 或者: from bokeh.models.GMapPlot import plot_width [as 别名]
def index():
    if request.method == 'GET':
        
        return render_template('index.html')
    else:
        if request.form.get("address"):
            app.address = request.form['address']
        else:
            app.address = False
        app.dayofweek = request.form['dayofweek']        
        app.direction = request.form['direction']
        app.timeofday = int(request.form['timeofday'])
        app.ampm = request.form['ampm']
        
        if app.address == False:
            app.msg = 'You must enter your desired address.'
            return render_template('error_page.html', msg = app.msg)
         
        params = {'address':str(app.address)}        
        r=(requests.get('https://maps.googleapis.com/maps/api/geocode/json',params=params)).json()
                
        app.formatted_address = r['results'][0]['formatted_address']
        my_latitude = r['results'][0]['geometry']['location']['lat']
        my_longitude = r['results'][0]['geometry']['location']['lng']

        x_min = -74.293396 #longitude  SW: 40.481965, -74.293396 NE:40.911486, -73.733866
        x_max = -73.733866 #longitude
        y_min = 40.481965 #latitude
        y_max = 40.911486 #latitude
        mesh_space = 0.01
        
        if my_latitude < y_min or my_latitude >= y_max or my_longitude < x_min or my_longitude>= x_max or app.address == "" or app.address == False:
            app.msg = 'The address you entered is outside the boundaries of NYC.'
            return render_template('error_page.html', msg = app.msg)


        centers_x,centers_rx=np.linspace(x_min,x_max,(x_max-x_min)/mesh_space,retstep="True")
        centers_y,centers_ry=np.linspace(y_min,y_max,(y_max-y_min)/mesh_space,retstep="True")
          
        my_center_id = get_center_id(my_longitude,my_latitude,x_min=x_min,x_max=x_max,y_min=y_min,y_max=y_max,mesh_space=mesh_space)
        
        input = open('../network_mesh_space=0.01_day='+str(app.dayofweek)+'.pickle','rb')        
        network_df = pickle.load(input)
        input.close()
        
        input = open('../main_data_mesh_space=0.01_day='+str(app.dayofweek)+'.pickle','rb')
        data_df = pickle.load(input)
        input.close()
                
                
        ##################################################
        ########Bokeh MAP block##############################
        x_range = Range1d()
        y_range = Range1d()
        
        # JSON style string taken from: https://snazzymaps.com/style/1/pale-dawn
        map_options = GMapOptions(lat=my_latitude, lng=my_longitude, map_type="roadmap", zoom=13, styles="""
        [{"featureType":"administrative","elementType":"all","stylers":[{"visibility":"on"},{"lightness":33}]},
        {"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2e5d4"}]},
        {"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#c5dac6"}]},
        {"featureType":"poi.park","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":20}]},
        {"featureType":"road","elementType":"all","stylers":[{"lightness":20}]},
        {"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#c5c6c6"}]},
        {"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#e4d7c6"}]},
        {"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#fbfaf7"}]},
        {"featureType":"water","elementType":"all","stylers":[{"visibility":"on"},{"color":"#acbcc9"}]}]""")
         
        plot = GMapPlot(
            x_range=x_range, y_range=y_range,
            map_options=map_options,
            title = ""
            #plot_width=750, plot_height=750
        )
        
        plot.plot_width = 800
        plot.plot_height = 800
        
        source = ColumnDataSource(
            data=dict(
                lat=[my_latitude],
                lon=[my_longitude],
                fill=['orange', 'blue', 'green']
            )
        )
        circle = Circle(x="lon", y="lat", size=10, fill_color="fill", line_color="black")
        plot.add_glyph(source, circle)

        source = ColumnDataSource(
            data=dict(
                lat=[my_latitude-0.005,my_latitude+0.005],
                lon=[my_longitude-0.005,my_longitude-0.005],
            )
        )
        line = Line(x="lon", y="lat", line_width=2, line_color="green")
        plot.add_glyph(source, line)
        

        source = ColumnDataSource(
            data=dict(
                lat=[my_latitude+0.005,my_latitude+0.005],
#.........这里部分代码省略.........
开发者ID:ionanrozenfeld,项目名称:taxi,代码行数:103,代码来源:app.py


注:本文中的bokeh.models.GMapPlot.plot_width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。