我正试着画一张带有点的Map。我想让传奇中的标记有一个黑色的边缘。如何配置标记的边缘颜色?
下面是我的代码:
import geopandas as gpd
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
# 创建一个包含经纬度坐标的GeoDataFrame
df = df_unique
gdf = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df['modern_longitude'], df['modern_latitude']),crs='EPSG:4326')
#创建投影对象
robinson = ccrs.Robinson()
# 将 GeoDataFrame 投影到 Robinson 投影坐标系下
gdf_robinson = gdf.to_crs(ccrs.Robinson().proj4_init)
# 读取地图数据
map_path = "110m_physical/ne_110m_land.shp"
world = gpd.read_file(map_path)
world=world.to_crs(ccrs.Robinson().proj4_init)
# 创建绘图对象
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(1, 1, 1, projection=robinson)
ax2 = ax
# 添加数据
world.plot(ax=ax2, color='lightgray', edgecolor='black')
gdf_robinson.plot(ax=ax, legend=True, legend_kwds = {"loc":'center left', "bbox_to_anchor": (1.1, 0.5),"edgecolor":'black',"title":"proxy"},column='proxy',cmap='tab20', markersize=50,edgecolor='black')
# ax.set_axis_off()
plt.show()
字符串
这是当前的图enter image description here
1条答案
按热度按时间qnzebej01#
字符串