如何从叶面中删除叶片中的大胆蓝色轮廓颜色。
我有以下geodataframe称为结果:
。
以及我想查看库库的位置对每个区域内的km总数有哪种类型的影响力。我要比较的变量是:t*_depot_0
,2_depots
,3_depots
和4_depots
。我想在每一层中使用fill_color orrd,以区分较深的红色和较低值的高值,较轻的橙色/黄色。通过具有图层控制,它将能够单击不同的绒毛膜,并查看每个区域内的总旅行距离上不同的仓库的区别。
我的代码:
def add_depot_markers_featuregroup(depot_amount, featuregroup):
for i in range(len(depots_locations)):
if i > depot_amount:
break
folium.Marker(
[depots_locations[i].y, depots_locations[i].x],
popup="Depot_{0}".format(i+1),
icon=folium.Icon(color='cadetblue', icon='solid fa-bicycle', prefix='fa')).add_to(featuregroup)
result_map = folium.Map(location=lat_long_groningen, zoom_start=11, tiles=None)
layer_depot_1 = folium.FeatureGroup(name="1 depot", overlay=False).add_to(result_map)
layer_depot_2 = folium.FeatureGroup(name="2 depots", overlay=False).add_to(result_map)
layer_depot_3 = folium.FeatureGroup(name="3 depots", overlay=False).add_to(result_map)
layer_depot_4 = folium.FeatureGroup(name="4 depots", overlay=False).add_to(result_map)
fs=[layer_depot_1, layer_depot_2, layer_depot_3, layer_depot_4]
for i in range(len(fs)):
add_depot_markers_featuregroup(i, fs[i])
depot_column_name = ""
if i == 0:
depot_column_name = "T*_depot_{0}".format(i)
else:
depot_column_name = "{0}_depots".format(i+1)
bins = list(results[depot_column_name].quantile([0, 0.25, 0.5, 0.75, 1]))
choropleth = folium.Choropleth(
results,
data=results,
key_on='feature.properties.Postcode',
columns=["Postcode", depot_column_name],
fill_color="OrRd",
fill_opacity = 0.8,
line_opacity = 0,
line_weight=1,
bins=bins,
legend_name = "T* per postalcode area based on depot {0}".format(i+1),
name="T* of {0} depot per Postalcode area".format(i+1)).geojson.add_to(fs[i])
geojson1 = folium.GeoJson(data=results,
name="tooltip " + depot_column_name,
tooltip=folium.GeoJsonTooltip(fields=['Postcode', "Deliveries", "Area (km2)", "Number of cyclists", "Beardwood approx", depot_column_name], labels=True, sticky=True)
).add_to(choropleth)
# folium.TileLayer('cartodbdark_matter',overlay=True,name="dark mode").add_to(result_map)
folium.TileLayer('cartodbpositron',overlay=True, control=False, name="T*").add_to(result_map)
folium.LayerControl(collapsed=False).add_to(result_map)
result_map.save("lastmile.html")
result_map
好消息是层正在起作用。坏消息是,我在地图上的不同多边形和多数基因之间有非常大胆的蓝线,我不知道该如何更改/删除。我已经尝试设置Choropleth的line_color =“ Black”
,但这无效。
如何删除/更改/最小化每个功能组中的大胆蓝色轮廓颜色?
I have the following geodataframe called results:
Calling results.explore()
will result in the following leaflet:
My idea is to create 4 different layers using Featuregroups and Choropleth wherein I want to see what type of influence depot location have on total amount of km's within each area. The variables I want to compare are: T*_depot_0
, 2_depots
, 3_depots
, and 4_depots
. I want to use the fill_color OrRd within each layer in order to distinguish high values with an darker red and lower values with lighter orange/yellow. By having layer control it would be able to click through the different Choropleth's and see the difference what different depots have on the total travel distance within each area.
My code:
def add_depot_markers_featuregroup(depot_amount, featuregroup):
for i in range(len(depots_locations)):
if i > depot_amount:
break
folium.Marker(
[depots_locations[i].y, depots_locations[i].x],
popup="Depot_{0}".format(i+1),
icon=folium.Icon(color='cadetblue', icon='solid fa-bicycle', prefix='fa')).add_to(featuregroup)
result_map = folium.Map(location=lat_long_groningen, zoom_start=11, tiles=None)
layer_depot_1 = folium.FeatureGroup(name="1 depot", overlay=False).add_to(result_map)
layer_depot_2 = folium.FeatureGroup(name="2 depots", overlay=False).add_to(result_map)
layer_depot_3 = folium.FeatureGroup(name="3 depots", overlay=False).add_to(result_map)
layer_depot_4 = folium.FeatureGroup(name="4 depots", overlay=False).add_to(result_map)
fs=[layer_depot_1, layer_depot_2, layer_depot_3, layer_depot_4]
for i in range(len(fs)):
add_depot_markers_featuregroup(i, fs[i])
depot_column_name = ""
if i == 0:
depot_column_name = "T*_depot_{0}".format(i)
else:
depot_column_name = "{0}_depots".format(i+1)
bins = list(results[depot_column_name].quantile([0, 0.25, 0.5, 0.75, 1]))
choropleth = folium.Choropleth(
results,
data=results,
key_on='feature.properties.Postcode',
columns=["Postcode", depot_column_name],
fill_color="OrRd",
fill_opacity = 0.8,
line_opacity = 0,
line_weight=1,
bins=bins,
legend_name = "T* per postalcode area based on depot {0}".format(i+1),
name="T* of {0} depot per Postalcode area".format(i+1)).geojson.add_to(fs[i])
geojson1 = folium.GeoJson(data=results,
name="tooltip " + depot_column_name,
tooltip=folium.GeoJsonTooltip(fields=['Postcode', "Deliveries", "Area (km2)", "Number of cyclists", "Beardwood approx", depot_column_name], labels=True, sticky=True)
).add_to(choropleth)
# folium.TileLayer('cartodbdark_matter',overlay=True,name="dark mode").add_to(result_map)
folium.TileLayer('cartodbpositron',overlay=True, control=False, name="T*").add_to(result_map)
folium.LayerControl(collapsed=False).add_to(result_map)
result_map.save("lastmile.html")
result_map
So, the good news is the layers work. The bad news is that I have very bold blue lines between the different polygons and multigons on the map, which I don't know how to change/remove. I've tried setting the line_color="black"
of the Choropleth, but that didn't work.
How to remove/change/minimize the bold blue outline colors within each featuregroup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于没有显示数据,因此我引用。多边形轮廓的线装饰由样式函数定义。样品定义了颜色,线宽度和虚线。线宽是由“重量”设置的。
Since no data is presented, I quote the official sample. The line decoration of the polygon's outline is defined by the style function. The sample defines color, line width, and dashed lines. Line width is set by 'weight'.