def to_png_with_pydot(self, filename): import pydot graph = pydot.Dot(graph_type='digraph', rankdir="LR") self._to_pydot(graph) graph.write_png(filename)