首页 > 解决方案 > 使用注释后 Matplot lib 不稳定

问题描述

我想知道是否有人可以发现我可能做错了什么,导致我在 Jupyter Labs 的情节中出现这种有点不稳定的行为。

我正在使用以下代码在地图上注释匀称点:

ax = gdf_2[gdf_2['Zone'] == 'ULEZ'].plot()

gdf_2.apply(lambda x: ax.annotate(s=x.pod_id_location, xy=x.loc['geometry'].coords[0]), axis=1)

ctx.add_basemap(ax=ax)

plt.axis('off')
plt.show()

出于某种原因,虽然这确实产生了我的情节,但它在笔记本上打印得很小。如果我尝试增加图形大小,有时会收到警告说我超出了像素限制,有时会导致内核死机。这就是我的情节的样子,下面是我背后的数据。

在此处输入图像描述

pod_id_location geometry    Zone
0   1245    POINT (-22993.152 6728924.970)  non-ULEZ
7940    2245    POINT (-13406.652 6714132.654)  ULEZ
13934   3245    POINT (-16958.244 6720147.066)  non-ULEZ
25068   5245    POINT (-20791.698 6699568.057)  non-ULEZ
32551   6245    POINT (-40049.413 6704610.464)  non-ULEZ
... ... ... ...
849223  742451  POINT (-12923.302 6720129.538)  non-ULEZ
849547  832450  POINT (-6445.287 6717978.299)   non-ULEZ
851190  872450  POINT (-4064.943 6697346.893)   non-ULEZ
852852  892450  POINT (6744.514 6713063.033)    non-ULEZ
853523  982450  POINT (-958.349 6706975.535)    non-ULEZ

标签: pythonpython-3.xmatplotlibgeopandas

解决方案


推荐阅读