Attribute "ratio"

Use:optional
Used by:graph
Description:Sets the aspect ratio (drawing height/drawing width) for the drawing. Note that this is adjusted before the size attribute constraints are enforced.

If ratio is numeric, it is taken as the desired aspect ratio. Then, if the actual aspect ratio is less than the desired ratio, the drawing height is scaled up to achieve the desired ratio; if the actual ratio is greater than that desired ratio, the drawing width is scaled up.

If ratio = "fill" and the size attribute is set, the drawing is scaled to achieve the aspect ratio implied by size. As size is set, when the drawing is later scaled to fit that rectangle, the resulting picture will fill the rectangle.

If ratio = "compress" and the size attribute is set, dot attempts to compress the initial layout to fit in the given size. This achieves a tighter packing of nodes but reduces the balance and symmetry.
Values:"fill", "compress" or a double value
Default Value:
Sponsored links:

Example 1/4:
Source code:
<graph file-name="graphs/ratio1" ratio="0.4" label="ratio='0.4'">
  
<node id="a"/>
<node id="b"/>
<node id="c"/>
<node id="d"/>
<edge from="a" to="b"/>
<edge from="a" to="c"/>
<edge from="b" to="d"/>
<edge from="c" to="d"/>
</graph>
Example 2/4:
Source code:
<graph file-name="graphs/ratio2" ratio="3.0" label="ratio='3.0'">
  
<node id="a"/>
<node id="b"/>
<node id="c"/>
<node id="d"/>
<edge from="a" to="b"/>
<edge from="a" to="c"/>
<edge from="b" to="d"/>
<edge from="c" to="d"/>
</graph>
Example 3/4:
Source code:
<graph file-name="graphs/ratio3" ratio="compress" size="3,3" label="size='3,3', ratio='compress'">
  
<node id="a"/>
<node id="b"/>
<node id="c"/>
<node id="d"/>
<edge from="a" to="b"/>
<edge from="a" to="c"/>
<edge from="b" to="d"/>
<edge from="c" to="d"/>
</graph>
Example 4/4:
Source code:
<graph file-name="graphs/ratio4" ratio="fill" size="8,3" label="size='8,3', ratio='fill'">
  
<node id="a"/>
<node id="b"/>
<node id="c"/>
<node id="d"/>
<edge from="a" to="b"/>
<edge from="a" to="c"/>
<edge from="b" to="d"/>
<edge from="c" to="d"/>
</graph>
Sponsored links

 Copyright 2002-2010 by Martin Loetzsch (http://martin-loetzsch.de), all rights reserved. See the DotML licence for details.