Open ecpeterson opened 3 years ago
Here is what I have been using
import matplotlib.pyplot as plt
plt.close()
fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
from weylchamber import WeylChamber
w = WeylChamber();
total_coord_list = []
for subpoly in reduced_vertices:
subpoly_coords = [[float(x) for x in coord] for coord in subpoly]
total_coord_list += subpoly_coords
w.scatter(*zip(*subpoly_coords))
from scipy.spatial import ConvexHull
pts = np.array(total_coord_list)
hull = ConvexHull(pts)
for s in hull.simplices:
s = np.append(s, s[0]) # Here we cycle back to the first coordinate
ax.plot(pts[s, 0], pts[s, 1], pts[s, 2], "r-")
w.render(ax)
%matplotlib widget
Here is my new version on my fork
Currently, our best polytope visualization option is to export a blob of Mathematica code for the user to run. This is not great.
I looked at a couple of python packages that draw polytopes, but I didn't make any headway.
pyny3d
has some really basic, matplotlib-style support for Polyhedra. My experience with drawing 3D figures inmpl
is that you have to handle depth sorting yourself, and all their examples look pretty trivial, so I didn't push very hard.fresnel
looks amazing, but I couldn't manage to survive the build process.