Created
October 3, 2023 23:46
-
-
Save cheginit/0abdba4a699cc438b6aead379ad00d3b to your computer and use it in GitHub Desktop.
Plot an example for Voroni Diagram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapely | |
import matplotlib.pyplot as plt | |
line = shapely.LineString([(0, 0), (2, 2), (5, 3), (6, 4), (9, 5), (12, 5), (15, 6)]) | |
poly = line.buffer(2.5) | |
fig, ax = plt.subplots(figsize=(6, 6), dpi=300) | |
gpd.GeoSeries(list(shapely.voronoi_polygons(poly).geoms)).plot(ax=ax, fc="none", ec="k", lw=0.5) | |
gpd.GeoSeries([poly]).plot(ax=ax, fc="none", ec="r", lw=2) | |
ax.set_axis_off() | |
fig.savefig("vd.svg", bbox_inches="tight") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment