Skip to content

Commit

Permalink
src/sage/geometry/polyhedral_complex.py (exploded_plot): Plot polyhed…
Browse files Browse the repository at this point in the history
…ra first, lines next and points last.
  • Loading branch information
yuan-zhou committed Aug 7, 2022
1 parent b064146 commit e8ec0eb
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/sage/geometry/polyhedral_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -2566,6 +2566,17 @@ def exploded_plot(polyhedra, *,
v.set_immutable()
vertex_translations_dict[v] = vertex_translations_dict.get(v, [])
vertex_translations_dict[v].append(v + t)

color = kwds.get('color')
if color == 'rainbow':
cell_colors_dict = dict(zip(polyhedra,
rainbow(len(polyhedra))))
for p, t in zip(polyhedra, translations):
options = copy(kwds)
if color == 'rainbow':
options['color'] = cell_colors_dict[p]
g += (p + t).plot(point=False, **options)

if sticky_vertices or sticky_center:
if sticky_vertices is True:
sticky_vertices = dict(color='gray')
Expand All @@ -2580,8 +2591,6 @@ def exploded_plot(polyhedra, *,
if sticky_vertices:
for vt1, vt2 in itertools.combinations(vertex_translations, 2):
g += line((vt1, vt2), **sticky_vertices)

color = kwds.get('color')
if point is None:
# default from sage.geometry.polyhedron.plot
point = dict(size=10)
Expand All @@ -2594,12 +2603,4 @@ def exploded_plot(polyhedra, *,
if color == 'rainbow':
options['color'] = vertex_colors_dict[vertex]
g += plot_point(vertex_translations, **options)
if color == 'rainbow':
cell_colors_dict = dict(zip(polyhedra,
rainbow(len(polyhedra))))
for p, t in zip(polyhedra, translations):
options = copy(kwds)
if color == 'rainbow':
options['color'] = cell_colors_dict[p]
g += (p + t).plot(point=False, **options)
return g

0 comments on commit e8ec0eb

Please sign in to comment.