What is the coordinate transformation between the graph bb and a .png image?

  • The bb is expanded by 4 graph-units in all directions (pad) to allow for finite line widths.
  • Then it is zoomed and/or rotated according to -Gviewport, -Gsize, -Glandscape, -Gorientation options. At the default scaling of 1:1, one graph unit = 1 point (1/72 inch).
  • Then it is paginated, if requested by -Gpage and if the output format supports it. Not the -Tpng renderer, yet.
  • Then a margin is added, -Gmargin, in absolute units (inches). The top/bottom margin can be set independently of the left/right margin.
  • Then it is converted to device units, according to -Gdpi, or a dpi value that is given by the output device, or a default that is provided by each render. There are separate dpi values for x and y to allow for non-square pixels. Some renderers invert the Y axis and need an offset to place the origin in the top left corner. The default dpi for -Tpng is 96dpi (approximating the resolution of most computer monitors) so this is where the scaling by 96/72 (4/3) comes from.

At the renderer api, plugins have a choice of coordinate representation:

  • coordinates in graph-units, and composite transformation data consisting of: scaling, rotation, and translation. (used by svg, cairo, ps, renderers)
  • coordinates pre-transformed into device units.


GraphvizWiki: FaqCoordTransformation (last edited 2008-01-17 18:40:25 by H-135-207-131-158)

Recent comments