pysal / libpysal

Core components of Python Spatial Analysis Library
http://pysal.org/libpysal
Other
259 stars 78 forks source link

Centroid or representative point in graph plotting #735

Closed martinfleis closed 3 months ago

martinfleis commented 3 months ago

Right now, when plotting graphs, we get node location using centroid. Occasionally, this means, that the node ends outside of the polygon, which can make graph interoperation a bit cumbersome. One example below but that one is easy. I can image, for example, some of the gerrymandered polygons causing a bit more of a trouble.

Shall we switch to using representative points instead? It is a bit slower but in this case it matters sometimes.

Screenshot 2024-07-01 at 21 31 24
jGaboardi commented 3 months ago

Perhaps a default keyword to "representative_point" so that we can still get centroids if desired?

martinfleis commented 3 months ago

If desired, you can do queen.explore(gdf.centroid). I'd rather avoid adding keywords.