Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set the Cluster font attributes in Graphviz?

Tags:

graphviz

I am able to successfully change the edge font, and the node font, but my attempts to change the cluster labels have no affect. Can someone point me in the right direction?

I have tried labelfontname=, fontname= (on the edge and the node), but can't seem to find the magic formula for cluster labels.

like image 767
MJB Avatar asked Jun 15 '11 17:06

MJB


People also ask

What is fontname in Graphviz?

If Graphviz is not built with a high-level font library, fontname will be considered the name of a Type 1 or True Type font file. If you specify fontname=schlbk, the tool will look for a file named schlbk.ttf or schlbk.pfa or schlbk.pfb in one of the directories specified by the fontpath attribute.

What is a cluster in GraphViz?

Graphviz - Graph Visualization Software Clusters. This small example illustrates dot’s feature to draw nodes and edges in clusters or separate rectangular layout regions. Clusters are encoded as subgraphs whose names have the prefix ‘cluster’. The color attribute of a cluster is interpreted as its outline color or its background color if ...

How do I set graph specific attributes on a graph?

It sets graph specific attributes on a graph, e.g. bgcolor as in this example. You can also omit the graph keyword and the brackets and specify the same attribute directly as in this example. Graph specific attributes are indicated with a G in the Used By column in the table in the Node, Edge and Graph Attributes documentation.

Where does GraphViz look for glyphs?

Otherwise, Graphviz will look in various default directories for the font. The directories to be searched include those specified by the fontpath attribute, related environment or shell variables (see the fontpath entry), and known system font directories. The table points out that these glyphs are from the times.ttf font.


1 Answers

fontname is working for cluster labels.

Here's an example with illustration - it's quite simple, just set it before setting the content of the label.

digraph g{
  node[fontname="Impact"];
  subgraph cluster0 {
    "Cluster node";
    fontname="Courier";
    label="Cluster label";
  }
  fontname="Arial";
  label="Graph Label";
}

The result:

graphviz output showing the effect of fontname on a cluster

like image 141
marapet Avatar answered Sep 20 '22 01:09

marapet