d.graph(1)
π d.graph(1) β the GRASS GIS bestie manual π
okay so. you found the page for d.graph, and honestly? it's a whole vibe. it's the GRASS GIS program for generating and displaying simple graphics right there on your display monitor. β¨ (the manual is the GRASS GIS User's Manual, for the record β yes, that one. hi. π«Ά)
β¨ NAME β¨
d.graph β program for generating and displaying simple graphics on the display monitor. π¨
πΈ KEYWORDS πΈ
display, cartography
π¦ SYNOPSIS π¦
d.graph
d.graph --help
d.graph [-m] [input=name] [color=string] [--help] [--verbose]
[--quiet] [--ui]
π Flags π
-mβ coordinates are given in map units. (map units!! not percentages. big deal, remember it π )--helpβ print usage summary--verboseβ verbose module output--quietβ quiet module output (shhh π€«)--uiβ force launching GUI dialog
π Parameters π
input=nameβ name of file containing graphics commands; if it's not given, it reads from standard inputcolor=stringβ color to draw with, either a standard GRASS color or anR:G:Btriplet. Default:blackπ€
π DESCRIPTION π
So d.graph draws graphics that are described either from standard input (that's the default), or from inside a file (if you name an input file on the command line). If you're entering graphics commands from standard input, you signal the end of input to d.graph with a CTRL-d. And coordinates are given either as a percentage of frame height and width (default) or in geographic coordinates (with the -m flag). pick your fighter. π
The program can be run interactively or non-interactively. You can run it completely non-interactively by specifying the name of a graphics file containing the d.graph graphics commands. If you run it non-interactively, the d.graph command gets saved to the display's dedraw history. π You can also choose to run the program partially interactively, by specifying any/all of the parameters except the graphics file input=name parameter on the command line. In that case, d.graph will expect you to input d.graph graphics commands from standard input (i.e., the keyboard) and will (silently) prompt you for these graphics commands. silent prompting, iconic behavior fr.
Alternately, you can simply type d.graph on the command line and be prompted for the values of all parameters. In that case, you get presented with the standard GRASS GUI interface. π₯οΈβ¨
The default coordinate system is 0-100 percent of the active frame in x and similarly 0-100 in y, regardless of the graphics monitor display frame size and aspect. The (0,0) location is the lower left corner of the active graphics monitor display frame. All values may be floating point. And if the -m flag is given, geographic coordinates will be used instead.
π COMMANDS π
the graphics language is simple, bestie, and it uses these commands:
[ # | move | draw | polygon | polyline | color | text | size | symbol |
rotation | icon | width ]
# commentβ a line of comment which is ignored in the processing. (it's giving "not me being here just for the aesthetic" π)move xpos yposβ the current location is updated toxpos ypos. Unless the-mflag is used, values are stated as a percent of the active display frame's horizontal (xpos) and vertical (ypos) size, and may be floating point values. Values are between0-100. Note: a space must separatexposandypos. (no cap, that space is non-negotiable π)draw xpos yposβ a line is drawn in the current color from the current location to the new locationxpos ypos, which then becomes the current location. Unless the-mflag is used, values are stated as a percent of the active display frame's horizontal (xpos) and vertical (ypos) size, and may be floating point values. Values are between0-100. Note: a space must separatexposandypos. π₯polygon xpos ypos xpos ypos ...β the coordinates appearing beneath the wordpolygon, one pair per line, circumscribe a polygon that is to be filled with the current color. π¨polyline xpos ypos xpos ypos ...β the coordinates appearing beneath the wordpolyline, one pair per line, circumscribe a polygon that is not to be filled with color. (outline only, main character energy π )color colorβ sets the current color to that stated; subsequent graphics will be drawn in the stated color, until the current color is set to a different color. Options arered,orange,yellow,green,blue,indigo,violet,brown,magenta,gray,white,black, anR:G:Btriplet (separated by colons), or the word"none"(draws in the default background color). πtext line-of-textβ the stated text is drawn at the current location using the current color, and the new current location is then positioned at the end of the text string. βοΈsize xper yperβ subsequent text will be drawn such that the text isxperpercent of the graphics monitor display frame wide andyperpercent of the frame high. By default, the text size is set to 5 percent of the active frame's width and 5 percent of the frame's height. If only one value is given, then that value will be used for both x and y scaling. Note: a space must separatexperandyper. πsymbol type size xper yper [line_color [fill_color]]β a symbol is drawn at the given size on the display monitor. Thexperandyperoptions define the center of the icon and are given as a percentage of the display frame (0,0is lower left). The symbol can be any of those stored in$GISBASE/etc/symbol/(e.g.basic/circle) or stored in the user's mapset directory in the form$MAPSET/symbol/type/name. The colors may be either a standard color name, anR:G:Btriplet, or"none". If using anR:G:Btriplet, each color value can range from 0-255. If not specified the defaultline_colorisblackand the defaultfill_colorisgrey. βrotation angleβ subsequent text and symbols will be drawn such that they are rotatedangledegrees counter-clockwise from east. πicon type size x yβ draws an icon of typeso,x, or+with specified size (in %) at locationx,y. Note: typeodesignates a square. πwidth valueβ subsequent lines (including non-FreeType text) will be drawn with the given pixel thickness. The default value is0. βοΈ
π EXAMPLES π
For an example use of d.graph, examine the contents of the command file grass_logo.txt located in the d.graph source code directory. It will draw the CERL GRASS logo using the d.graph graphing commands stored in the file. Note that the coordinates in the grass_logo.txt file were taken directly off an image drawn by hand on graph paper. (hand-drawn on graph paper?? the dedication. ππ«Ά)
A dynamic example can be found in the d.polar shell script.
β Draw a "star" symbol at a given map coordinate
echo "symbol basic/star 20 2264417 5413182 black red" | d.graph -m
π Split the screen into quadrants:
d.frame -s full_screen
d.graph << EOF
color 80:80:120
polygon
0 49.75
0 50.25
100 50.25
100 49.75
polygon
49.85 0
50.15 0
50.15 100
49.85 100
EOF
π§ NOTES π§
d.graph remembers the last screen location (xpos ypos) to which the user moved, even after the user erases the display frame. so if you run d.graph repeatedly and you want to start fresh with the default (xpos ypos) screen location, you should clear the display frame between runs of d.graph. she's got a memory bestie, she does not forget π
π LIMITATIONS π
There are no automated ways of generating graphic images. It is anticipated that GRASS user sites will write programs to convert output from a resident graphics editor into GRASS d.graph format. (e.g. EPS -> d.graph, perhaps with the help of a pstoedit plugin)
π SEE ALSO π
d.font, d.labels, d.polar, d.text, d.where
π«Ά AUTHOR π«Ά
James Westervelt, U.S. Army Construction Engineering Research Laboratory
π SOURCE CODE π
Available at: d.graph source code (history)
okay and for the cute sign-off: this whole thing was pulled from the GRASS 8.4.2 Reference Manual, accessed Saturday Jan 17 05:40:34 2026, Β© 2003-2025 GRASS Development Team, running on GRASS 8.4.2. slay, go draw something pretty bestie πβ¨ππ¦πΈπ
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms