# How to set node color and font size in a Digraph setting with edges

**URL:** <https://forum.graphviz.org/t/how-to-set-node-color-and-font-size-in-a-digraph-setting-with-edges/1046>\
**Category:** Help\
**Created:** [February 18, 2022, 7:35am UTC](https://forum.graphviz.org/t/how-to-set-node-color-and-font-size-in-a-digraph-setting-with-edges/1046 "2022-02-18T07:35:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fung](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@fung](https://forum.graphviz.org/u/fung)\
**Post date:** [February 18, 2022, 7:35am UTC](https://forum.graphviz.org/t/how-to-set-node-color-and-font-size-in-a-digraph-setting-with-edges/1046/1 "2022-02-18T07:35:58Z")

</div>

Hello! I created a Digraph with information,but no node API.  
I just want to set the background color and font size of a specific node .  
How can I do it?  
Thanks.

[Digraph]([![HTavRJ.jpg](https://global.discourse-cdn.com/graphviz/original/1X/196d88683f428c421190fcf787a23ff9fc79e425.jpeg)](https://imgtu.com/i/HTavRJ))

[![](https://global.discourse-cdn.com/graphviz/original/1X/1cc392d38951e01a683e5357c39816ca0087de1f.jpeg)](https://imgtu.com/i/HTdwwV)

---

<div class="post-metadata">

**Author:** ![erg](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/erg/32/34_2.png) [@erg](https://forum.graphviz.org/u/erg)\
**Post date:** [February 19, 2022, 10:06pm UTC](https://forum.graphviz.org/t/how-to-set-node-color-and-font-size-in-a-digraph-setting-with-edges/1046/2 "2022-02-19T22:06:59Z")

</div>

When you generate an edge using the `g.edge` command, you appear to be using `row[0]+'.'+row[1]` as the name of the tail node, and `row[2]+'.'+row[3]` as the name of the head node. Just using edge statements declares the relevant nodes implicitly. To attach an attribute to a node, you will need to declare a node explicitly. For the attributes you desire, this presumably would use a command like  
`g.node(nodename, fontsize='14', fillcolor='green', style='filled')`  
where `nodename` is a string of the form `row[0]+'.'+row[1]` or row[2]+’.’+row[3], as appropriate.

---

<div class="post-metadata">

**Author:** ![fung](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@fung](https://forum.graphviz.org/u/fung)\
**Post date:** [February 20, 2022, 12:33am UTC](https://forum.graphviz.org/t/how-to-set-node-color-and-font-size-in-a-digraph-setting-with-edges/1046/3 "2022-02-20T00:33:14Z")

</div>

OK ！thanks!
