Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
ManifoldSubset.declare_empty: Add plot
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Apr 24, 2021
1 parent 28650bc commit 26401dd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/sage/manifolds/subset.py
Expand Up @@ -1169,6 +1169,26 @@ def declare_empty(self):
sage: P.plot(element_labels={element: label(element) for element in P})
Graphics object consisting of 14 graphics primitives
.. PLOT::
def label(element):
if isinstance(element, str):
return element
try:
return element._name
except AttributeError:
return '[' + ', '.join(sorted(x._name for x in element)) + ']'
M = Manifold(2, 'M', structure='topological')
A = M.subset('A', is_open=True)
AA = A.subset('AA')
A.declare_empty()
AD = A.subset('AD')
B = M.subset('B')
b = B.point(name='b')
P = M.subset_poset(open_covers=True, points=[b])
g1 = P.plot(element_labels={element: label(element) for element in P})
sphinx_plot(graphics_array([g1]), figsize=(8, 3))
"""
if self.has_defined_points():
raise TypeError('cannot be empty because it has defined points')
Expand Down

0 comments on commit 26401dd

Please sign in to comment.