Controlling bitmap processing

I'm trying to

  • create a graph to be displayed on the website via Graphviz.
  • make each node clickable with imagemap (or some other tool).

To do this I have to display a graph

  • What attribute should be set to get the maximum width / height of the displayed graph? I took a look at http://www.graphviz.org/doc/info/attrs.html and tried to manipulate attributes like size

    , but it didn't seem to work for me.
  • How to interpret the attributes of pos

    nodes and edges?
+2


source to share


1 answer


Size control

As you correctly guessed, this can be done by changing size

.

Here are some examples:

digraph {1->2;}

      

Image dimensions: 83 * 155 pixels . This is the graph size with default settings.

digraph {size=1; 1->2;}

      

Image dimensions: 51 * 96 pixels . The image has been reduced to 1 inch (96 dpi). This is expected behavior as the documentation states:

If the specified and the pattern is larger than the specified size, the pattern is evenly reduced to fit within the specified size.

digraph {size=2; 1->2;}

      

Image dimensions: 83 * 155 pixels . Again expected behavior, the graph is already less than 2 inches and does not need to be scaled down.

digraph {size="2!"; 1->2;}

      



Image dimensions: 103 * 192 pixels . The graph was zoomed in until one of the dimensions was 2 inches. Expected behavior as the documentation states:

If the size ends with an exclamation mark (!), Then it is taken as the desired size. In this case, if both dimensions of the picture are less than the size, the drawing is scaled evenly, to at least one dimension equal to its dimension.

Interpreting pos attributes of nodes and edges

I am assuming you mean the values pos

for the xdot format.

xdot graph

digraph {1->2;}

      

is as follows

digraph {
    node [label="\N"];
    graph [bb="0,0,54,108",
        _draw_="c 9 -#ffffffff C 9 -#ffffffff P 4 0 -1 0 108 55 108 55 -1 ",
        xdotversion="1.2"];
    1 [pos="27,90", width="0.75", height="0.5", _draw_="c 9 -#000000ff e 27 90 27 18 ", _ldraw_="F 14.000000 11 -Times-Roman c 9 -#000000ff T 27 84 0 7 1 -1 "];
    2 [pos="27,18", width="0.75", height="0.5", _draw_="c 9 -#000000ff e 27 18 27 18 ", _ldraw_="F 14.000000 11 -Times-Roman c 9 -#000000ff T 27 12 0 7 1 -2 "];
    1 -> 2 [pos="e,27,36.413 27,71.831 27,64.131 27,54.974 27,46.417", _draw_="c 9 -#000000ff B 4 27 72 27 64 27 55 27 46 ", _hdraw_="S 5 -solid c 9 -#000000ff C 9 -#000000ff P 3 31 46 27 36 24 46 "];
}

      

The pos values ​​for the nodes indicate the center of the node's position. Since the bounding box of the graph is "0,0,54,108", the node positions "27.18" and "27.90" are perfectly horizontal.

For edges, I think it pos

contains the points of the edge segments, whereas it _draw_

contains the B-Spline breakpoints (but I'm not sure about that).

+9


source







All Articles