Skip to content

Commit a88fa60

Browse files
committed
PlotTheme -> GraphLayout. Set Plot Title
1 parent 04a0ff8 commit a88fa60

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

mathicsscript/format.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,19 @@ def format_graph(G, options):
247247
# FIXME handle graphviz as well
248248
import matplotlib.pyplot as plt
249249

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

255-
if plot_theme:
256-
if not isinstance(plot_theme, str):
257-
plot_theme = plot_theme.get_string_value()
258-
layout_fn = NETWORKX_LAYOUTS.get(plot_theme, None)
255+
if hasattr(G, "title") and G.title.get_string_value():
256+
fig, ax = plt.subplots() # Create a figure and an axes
257+
ax.set_title(G.title.get_string_value())
258+
259+
if graph_layout:
260+
if not isinstance(graph_layout, str):
261+
graph_layout = graph_layout.get_string_value()
262+
layout_fn = NETWORKX_LAYOUTS.get(graph_layout, None)
259263
else:
260264
layout_fn = None
261265

0 commit comments

Comments
 (0)