使用 naturalearth_lowres 绘制地理数据框
Plotting a Geodataframe using naturalearth_lowres
我有一个包含与火灾事件相关的几何点的地理数据框。我使用 naturalearth_lowres 数据集将它们绘制在世界地图上:
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
gdf.plot(ax=world.plot (figsize=(25,10)), marker='.', color='black')
这次我想对交互式地图做同样的事情,但是当我将“plot”替换为“explore”时出现错误:
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
gdf.explore(ax=world.plot (figsize=(25,10)), marker='.', color='black')
TypeError: type object got multiple values for keyword argument 'marker'
有什么办法吗?
您正在混合使用 matplotlib 和 folium。它们是单独的库,可以独立使用。
plot()
使用 matplotlib
explore()
使用 folium
为了代码的目的,使用了地震而不是火灾。下面将在单个 folium 地图上绘制低分辨率地球和地震图。
import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
gdf = gpd.read_file("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_week.geojson")
m = world.explore()
gdf.explore(m=m, color="black")
我有一个包含与火灾事件相关的几何点的地理数据框。我使用 naturalearth_lowres 数据集将它们绘制在世界地图上:
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
gdf.plot(ax=world.plot (figsize=(25,10)), marker='.', color='black')
这次我想对交互式地图做同样的事情,但是当我将“plot”替换为“explore”时出现错误:
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
gdf.explore(ax=world.plot (figsize=(25,10)), marker='.', color='black')
TypeError: type object got multiple values for keyword argument 'marker'
有什么办法吗?
您正在混合使用 matplotlib 和 folium。它们是单独的库,可以独立使用。
plot()
使用 matplotlibexplore()
使用 folium
为了代码的目的,使用了地震而不是火灾。下面将在单个 folium 地图上绘制低分辨率地球和地震图。
import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
gdf = gpd.read_file("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_week.geojson")
m = world.explore()
gdf.explore(m=m, color="black")