如何获得传奇
我正在尝试用Shapefiles绘制一些数据,但是我需要一个传奇来区分哪种shapefile在哪种颜色上。我为每个shapefile分配了颜色,但棘手的部分是创建一个传奇。
我的代码如下:
data = gpd.GeoDataFrame(data, geometry=gpd.points_from_xy(data.INTPTLON, data.INTPTLAT))
fig, ax = plt.subplots(figsize=(10, 10))
DC_BLK.plot(ax=ax,edgecolor = "black" ,facecolor = "None")
DC_BG.plot(ax=ax, edgecolor = "lightblue",facecolor = "None")
DC_CT.plot(ax=ax,edgecolor = "purple",facecolor = "None")
data.plot(ax=ax , marker = '.')
ax.set_title('Washington DC - 7x pop')
plt.show()
数据。情节 - 使用经度&绘制三个点;纬度在地图上。 dc_blk-包含直流块的shapefile DC_BG-包含直流块组的shapefile DC_CT-包含DC人口普查区的ShapeFile
I am trying to graph some data with shapefiles, but I need a legend to distinguish which shapefile is in which color. I assigned a color to each shapefile, but the tricky part is to create a legend.
My code is below:
data = gpd.GeoDataFrame(data, geometry=gpd.points_from_xy(data.INTPTLON, data.INTPTLAT))
fig, ax = plt.subplots(figsize=(10, 10))
DC_BLK.plot(ax=ax,edgecolor = "black" ,facecolor = "None")
DC_BG.plot(ax=ax, edgecolor = "lightblue",facecolor = "None")
DC_CT.plot(ax=ax,edgecolor = "purple",facecolor = "None")
data.plot(ax=ax , marker = '.')
ax.set_title('Washington DC - 7x pop')
plt.show()
data. plot - plots three points using longitude & latitude onto the map.
DC_BLK - shapefile containing DC blocks
DC_BG - shapefile containing DC block groups
DC_CT - shapefile containing DC Census tract
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了。我想发布我所做的事情,以防有人遇到类似的问题。
这是我所做的:
希望这会有所帮助
I figured it out. I wanted to post what I did just in case someone runs into a similar problem.
Here is what i did:
Hope this helps