Skip to content

Commit a61a50a

Browse files
committed
Use equal aspect ratio on ciruclar graphs
1 parent 3214345 commit a61a50a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mathicsscript/format.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ def spiral_equidistant_layout(G, *args, **kwargs):
276276

277277
NETWORKX_LAYOUTS = {
278278
"circular": nx.circular_layout,
279+
"kamada_kawai": nx.kamada_kawai_layout,
279280
"multipartite": nx.multipartite_layout,
280281
"planar": nx.planar_layout,
281282
"random": nx.random_layout,
@@ -374,6 +375,9 @@ def format_graph(G):
374375
if not isinstance(graph_layout, str):
375376
graph_layout = graph_layout.get_string_value()
376377
layout_fn = NETWORKX_LAYOUTS.get(graph_layout, None)
378+
if graph_layout in ["circular", "spiral", "spiral_equidistant"]:
379+
plt.axes().set_aspect("equal")
380+
377381

378382
harmonize_parameters(G, draw_options)
379383

0 commit comments

Comments
 (0)