You pass the fit_view = False
option to graph_draw()
, it will not attempt to scale the drawing to fit the output size. You can then choose your view by changing the posions of the nodes, such that it does not exclude any part of the graph:
g = random_graph(10, lambda: 10, self_loops=True, directed=False)
pos = sfdp_layout(g)
x, y = ungroup_vector_property(pos, [0, 1])
x.a = (x.a - x.a.min()) / (x.a.max() - x.a.min()) * 200 + 100
y.a = (y.a - y.a.min()) / (y.a.max() - y.a.min()) * 200 + 100
pos = group_vector_property([x, y])
graph_draw(g, pos, output_size=(400, 400), output="foo.png", fit_view=False)
You can improve the edge labels by tuning the properties text_distance
, text_parallel
and font_size
.