# Rendering graphviz with python

**URL:** <https://forum.graphviz.org/t/rendering-graphviz-with-python/148>\
**Category:** Help\
**Created:** [May 31, 2020, 4:32pm UTC](https://forum.graphviz.org/t/rendering-graphviz-with-python/148 "2020-05-31T16:32:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![h1dd3n](https://avatars.discourse-cdn.com/v4/letter/h/f9ae1b/32.png) [@h1dd3n](https://forum.graphviz.org/u/h1dd3n)\
**Post date:** [May 31, 2020, 4:32pm UTC](https://forum.graphviz.org/t/rendering-graphviz-with-python/148/1 "2020-05-31T16:32:31Z")

</div>

Good day. I’m trying out graphviz and am liking it. The problems is i’m not really getting enough understanding of it and bumped up into a problem, so i came here.

I’ve extracted 10k links, filtered them and made a graph with links. The problem is it’s too wide.  
When i open it in pdf, i can’t zoom in enough to see what actually is happening. Could some one give me some information how to handle this situation or what am i missing out on?  
P.S sadly can’t upload a pdf, but the problem basically is that the edges are being stached horizontaly.

---

<div class="post-metadata">

**Author:** ![magjac](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/magjac/32/16_2.png) [@magjac](https://forum.graphviz.org/u/magjac)\
**Post date:** [May 31, 2020, 5:08pm UTC](https://forum.graphviz.org/t/rendering-graphviz-with-python/148/2 "2020-05-31T17:08:14Z")

</div>

Can you upload your DOT source somewhere and provide a link to it?

---

<div class="post-metadata">

**Author:** ![h1dd3n](https://avatars.discourse-cdn.com/v4/letter/h/f9ae1b/32.png) [@h1dd3n](https://forum.graphviz.org/u/h1dd3n)\
**Post date:** [May 31, 2020, 8:17pm UTC](https://forum.graphviz.org/t/rendering-graphviz-with-python/148/3 "2020-05-31T20:17:03Z")

</div>

```
   import graphviz

        class Test:
            def __init__ (self):
                self.graph = graphviz.Digraph('unix', filename='unix3',
                                              node_attr={'color': 'lightblue2', 'style': 'filled'})
                self.graph.attr(size='10')
                # self.graph.edge_attr['imagepos'] ='bl'
                self.set = []

            def go_mad(self):
                with open('data.json', 'r+') as f:
                    file = f.read()
                    json_data = json.loads(file)

                    for i in json_data['data']:
                        head = i['original']
                        tail = i['found']
                        self.graph.edge(head, tail)
                    # self.graph.engine = 'unix'
                    self.graph.view()
```
