Prevent nodes from overlapping the edge of the image in python iGraph

I am using iGraph for python to draw some graphs and I cannot seem to prevent the nodes from hitting the edge of the image, especially with very few nodes. In cases with thousands of nodes the opposite is actually true, they are too clustered in the center. Is there a way to influence the behavior of the layout to control the density of the nodes, or at least stop them from getting cut off? here is the code so far:

 visual_style = {}
    visual_style["vertex_size"] = sz
    visual_style["layout"] = gg.layout_fruchterman_reingold()
    visual_style["bbox"] = (4000, 4000)
    visual_style["margin"] = 20
    visual_style["edge_arrow_size"] = 0
    visual_style["edge_color"] = 'White'
    visual_style['edge_width'] = ew
    visual_style["edge_curved"] = .2
    # print(visual_style)
    plot(gg,"./images/"+str(i)+".png", autocurve=True, background='Black',asp=0, **visual_style)

the graphML file I am importing contains this data:

<?xml version='1.0' encoding='utf-8'?>
<graphml xmlns="" xmlns:xsi="" xsi:schemaLocation="">
  <key id="d0" for="node""color" attr.type="string" />
  <key id="d1" for="node""shape" attr.type="string" />
  <graph edgedefault="undirected">
    <node id="16">
      <data key="d0">#ffb812</data>
      <data key="d1">triangle</data>
    <node id="3594">
      <data key="d0">#00b8ce</data>
      <data key="d1">circle</data>
    <node id="9951">
      <data key="d0">#00b8ce</data>
      <data key="d1">circle</data>
    <node id="11439">
      <data key="d0">#00b8ce</data>
      <data key="d1">circle</data>
    <node id="13349">
      <data key="d0">#00b8ce</data>
      <data key="d1">circle</data>
    <edge source="16" target="3594" />
    <edge source="3594" target="9951" />
    <edge source="9951" target="11439" />
    <edge source="9951" target="13349" />

Have you tried setting a higher value for the margin? Setting keep_aspect_ratio=True may also help.