pydot / pydot-ng

Python interface to Graphviz's Dot language compatible with Python 2 nad Python 3
MIT License
22 stars 10 forks source link

[80] Setting default graph/node/edge attrs in an existing graph has no effect #16

Open prmtl opened 9 years ago

prmtl commented 9 years ago

Reported by zvi.ta...@gmail.com, 2013-03-01T10:46:07Z

What steps will reproduce the problem?
  1. g = pydot.graph_from_dot_data(""" digraph G { 1 -> 2; } """)
  2. g.set_node_defaults(style="filled", fillcolor="yellow")
  3. g.write_png("simple.yellow.png")
    What is the expected output? What do you see instead?

Should see yellow nodes, but nodes are still white.

What version of the product are you using? On what operating system?

Pydot 1.0.28, Python 2.7.3

Please provide any additional information below.

Default attributes are added to the BOTTOM of the DOT spec, after existing nodes and edges, so they don't take effect. They should be inserted at the TOP of the spec to take effect everywhere.

The attached file demonstrates the problem and the solution. Attached pydot_bug.py (view on Gist) From: https://code.google.com/p/pydot/issues/detail?id=80