I am wondering if I can define an alternative font for the whole graph.
... digraph script_concept { graph [layout="dot",fontname="helvetica"]; ...
According to this 1 older post the fontname atribute can be defined only separately:
Nodes and edges don't inherit the font of the graph, you need to specify them separately
Is there any other way, how to define the font globally?
As in the forum post you linked, you have to define the default values separately (like the other attributes) at the beginning of your graphviz file: digraph g { graph [fontname = "helvetica"]; node [fontname = "helvetica"]; edge [fontname = "helvetica"]; ... }
I need to convert to png. You may use HTML-like labels in graphviz and define labels with partially bold text: Note the restriction ... "In addition, all of these markups are currently only available via the cairo and svg renderers."
The graphviz module provides two classes: Graph and Digraph. They create graph descriptions in the DOT language for undirected and directed graphs respectively.
The graphviz package provides two main classes: graphviz.Graph and graphviz.Digraph. They create graph descriptions in the DOT language for undirected and directed graphs respectively. They have the same API. Graph and Digraph produce different DOT syntax and have different values for directed.
No, there is no other way.
As in the forum post you linked, you have to define the default values separately (like the other attributes) at the beginning of your graphviz file:
digraph g { graph [fontname = "helvetica"]; node [fontname = "helvetica"]; edge [fontname = "helvetica"]; ... }
Not sure if this is a recent update, but you can change these at the command-line level using the -G
, -E
and -N
attribute flags. That is, the following works for me:
$ dot -Tpng -Nfontname=Roboto -Nfontsize=10 \ -Efontname=Roboto -Efontsize=10 \ tree.dot > tree.png
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With