from graphviz import Digraph from collections import Counter from random import * liste = [randint(1,6)+randint(1,6) for n in range(1000)] effectifs = Counter(liste) g = Digraph(format='png') for k in effectifs: g.node(str(k),str(k),shape='box3d',style='filled',fillcolor='cyan') g.node(str(effectifs[k]),str(effectifs[k]),shape='doublecircle',style='filled',fillcolor='yellow') g.edge(str(k),str(effectifs[k]),color='red',rankdir='LR') g.render('graphe1',view=True)