LinuxCommandLibrary

grap2graph

Convert grap (graph description) to graph format

SYNOPSIS

grap2graph [-h] [-v] [-Nnetfont] [-Ggraphfont] [-Ffontdir] [-dscale] [-Dscale] [-ooutfile] [files…]

PARAMETERS

-h
    Print usage information and exit.

-v
    Print version information and library paths.

-Nnetfont
    Font for node labels (default: Helvetica).

-Ggraphfont
    Font for graph title (default: Helvetica-Bold).

-Ffontdir
    Additional directory to search for fonts.

-dscale
    Scale factor for node distances (default: 1.0).

-Dscale
    Scale factor for overall graph diagram (default: 1.0).

-ooutfile
    Output file name (default: grap.dot).

DESCRIPTION

grap2graph translates input written in the grap language—a simple descriptive language for scientific graphs, plots, bar charts, and diagrams—into Graphviz's dot format. Originally designed to work with troff via the pic preprocessor, grap excels at data visualization. grap2graph enables rendering these diagrams using powerful Graphviz layout engines like dot, neato, or circo, producing high-quality SVG, PDF, or PNG outputs.

It reads grap source from files or stdin, internally invokes the grap and pic preprocessors (from groff), and generates a dot file with customizable fonts, scales for node distances, and diagram size. This makes legacy grap content compatible with modern tools, ideal for documentation, academic papers, reports, and web publications. No troff processing is needed, simplifying workflows.

CAVEATS

Requires groff with grap(1) and pic(1) support installed. Outputs dot source; use Graphviz tools separately to generate images. Limited to planar layouts depending on input complexity.

USAGE EXAMPLE

grap2graph -N Arial -d 1.5 -o mygraph.dot input.grap
dot -Tsvg mygraph.dot -o mygraph.svg

INPUT HANDLING

Concatenates multiple files; uses stdin if none provided. Supports standard grap syntax for plots, arrows, labels.

HISTORY

Developed by Jef Poskanzer <jef@mail.acme.com> at Acme Laboratories. First released around 2000s as a bridge between grap and emerging Graphviz ecosystem; maintained sporadically, available in groff-related packages on Linux distributions.

SEE ALSO

grap(1), pic(1), dot(1), neato(1), groff(1)

Copied to clipboard