Skip to content

Instantly share code, notes, and snippets.

@cheginit
Created October 3, 2023 23:46
Show Gist options
  • Save cheginit/0abdba4a699cc438b6aead379ad00d3b to your computer and use it in GitHub Desktop.
Save cheginit/0abdba4a699cc438b6aead379ad00d3b to your computer and use it in GitHub Desktop.
Plot an example for Voroni Diagram
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