Skip to content

Commit 78ad745

Browse files
committed
Simplify graph formatting
1 parent a88fa60 commit 78ad745

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mathicsscript/format.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def format_output(obj, expr, format=None):
4040
result = Expression("StandardForm", expr).format(obj, "System`TeXForm")
4141
elif format == "unformatted":
4242
if str(expr) == "-Graph-":
43-
return format_graph(expr.G, expr.options)
43+
return format_graph(expr.G)
4444
else:
4545
result = expr.format(obj, "System`OutputForm")
4646
else:
@@ -240,15 +240,15 @@ def tree_layout(G):
240240
}
241241

242242

243-
def format_graph(G, options):
243+
def format_graph(G):
244244
"""
245245
Format a Graph
246246
"""
247247
# FIXME handle graphviz as well
248248
import matplotlib.pyplot as plt
249249

250-
graph_layout = options.get("GraphLayout", None) if options else None
251-
vertex_labeling = options.get("VertexLabeling", None) if options else None
250+
graph_layout = G.graph_layout if hasattr(G, "graph_layout") else None
251+
vertex_labeling = G.vertex_labeling if hasattr(G, "vertex_labeling") else False
252252
if vertex_labeling:
253253
vertex_labeling = vertex_labeling.to_python() or False
254254

0 commit comments

Comments
 (0)