bellockk / alphashape

Toolbox for constructing alpha shapes.
MIT License
252 stars 28 forks source link

Documentation issue #44

Open pjuangph opened 1 year ago

pjuangph commented 1 year ago

I followed the documentation example. https://github.com/bellockk/alphashape#readme It seems there is a compatibility issue with PolygonPatch.

Here's what I ran. I expected a plot but got an error.

import os
import sys
import pandas as pd
import numpy as np
from descartes import PolygonPatch
import matplotlib.pyplot as plt
sys.path.insert(0, os.path.dirname(os.getcwd()))
import alphashape

points_2d = [(0., 0.), (0., 1.), (1., 1.), (1., 0.),
          (0.5, 0.25), (0.5, 0.75), (0.25, 0.5), (0.75, 0.5)]

alpha_shape = alphashape.alphashape(points_2d, 0.)
alpha_shape
fig, ax = plt.subplots()
ax.scatter(*zip(*points_2d))
ax.add_patch(PolygonPatch(alpha_shape, alpha=0.2))
plt.show()