1d.graph(1) GRASS GIS User's Manual d.graph(1)
2
3
4
6 d.graph - Program for generating and displaying simple graphics on the
7 display monitor.
8
10 display, cartography
11
13 d.graph
14 d.graph --help
15 d.graph [-m] [input=name] [color=string] [--help] [--verbose]
16 [--quiet] [--ui]
17
18 Flags:
19 -m
20 Coordinates are given in map units
21
22 --help
23 Print usage summary
24
25 --verbose
26 Verbose module output
27
28 --quiet
29 Quiet module output
30
31 --ui
32 Force launching GUI dialog
33
34 Parameters:
35 input=name
36 Name of file containing graphics commands, if not given reads from
37 standard input
38
39 color=string
40 Color to draw with, either a standard GRASS color or R:G:B triplet
41 Default: black
42
44 d.graph draws graphics that are described either from standard input
45 (default), or within a file (if an input file name is identified on the
46 command line). If graphics commands are entered from standard input, a
47 CTRL-d is used to signal the end of input to d.graph. Coordinates are
48 given either as a percentage of frame height and width (default) or in
49 geographic coordinates (with the -m flag).
50
51 The program can be run interactively or non-interactively. The user
52 can run the program completely non-interactively by specifying the name
53 of a graphics file containing the d.graph graphics commands. If run
54 non-interactively the d.graph command is saved to the display’s dedraw
55 history. The user can also elect to run the program partially interac‐
56 tively, by specifying any/all of the parameters except the graphics
57 file input=name parameter on the command line. In this case, d.graph
58 will expect the user to input d.graph graphics commands from standard
59 input (i.e., the keyboard) and will (silently) prompt the user for
60 these graphics commands.
61
62 Alternately, the user can simply type d.graph on the command line, and
63 be prompted for the values of all parameters. In this case, the user is
64 presented with the standard GRASS GUI interface.
65
66 The default coordinate system used is 0-100 percent of the active frame
67 in x and similarly 0-100 in y, regardless of the graphics monitor dis‐
68 play frame size and aspect. The (0,0) location is the lower left cor‐
69 ner of the active graphics monitor display frame. All values may be
70 floating point. If the -m flag is given, geographic coordinates will
71 be used instead.
72
74 The graphics language is simple, and uses the following commands:
75 [ # | move | draw | polygon | polyline | color | text | size |
76 symbol | rotation | icon | width ]
77
78 # comment
79 A line of comment which is ignored in the processing.
80
81 move xpos ypos
82 The current location is updated to xpos ypos. Unless the -m flag
83 is used, values are stated as a percent of the active display
84 frame’s horizontal (xpos) and vertical (ypos) size, and may be
85 floating point values. Values are between 0-100. Note. A space
86 must separate xpos and ypos.
87
88 draw xpos ypos
89 A line is drawn in the current color from the current location to
90 the new location xpos ypos, which then becomes the current loca‐
91 tion. Unless the -m flag is used, values are stated as a percent
92 of the active display frame’s horizontal (xpos) and vertical (ypos)
93 size, and may be floating point values. Values are between 0-100.
94 Note. A space must separate xpos and ypos.
95
96 polygon   xpos ypos   xpos ypos   ...
97 The coordinates appearing beneath the word polygon, one pair per
98 line, circumscribe a polygon that is to be filled with the current
99 color.
100
101 polyline   xpos ypos   xpos ypos   ...
102 The coordinates appearing beneath the word polyline, one pair per
103 line, circumscribe a polygon that is not to be filled with color.
104
105 color color
106 Sets the current color to that stated; subsequent graphics will be
107 drawn in the stated color, until the current color is set to a dif‐
108 ferent color. Options are red, orange, yellow, green, blue, in‐
109 digo, violet, brown, magenta, gray, white, black, an R:G:B triplet
110 (separated by colons), or the word "none" (draws in the default
111 background color).
112
113 text line-of-text
114 The stated text is drawn at the current location using the current
115 color, and the new current location is then positioned at the end
116 of the text string.
117
118 size xper yper
119 Subsequent text will be drawn such that the text is xper percent of
120 the graphics monitor display frame wide and yper percent of the
121 frame high. By default, the text size is set to 5 percent of the
122 active frame’s width and 5 percent of the frame’s height. If only
123 one value is given, then that value will be used for both x and y
124 scaling.
125 Note. A space must separate xper and yper.
126
127 symbol type size xper yper [line_color [fill_color]]
128 A symbol is drawn at the given size on the display monitor. The
129 xper and yper options define the center of the icon and are given
130 as a percentage of the display frame (0,0 is lower left). The sym‐
131 bol can be any of those stored in $GISBASE/etc/symbol/ (e.g. ba‐
132 sic/circle) or stored in the user’s mapset directory in the form
133 $MAPSET/symbol/type/name. The colors may be either a standard
134 color name, an R:G:B triplet, or "none". If using an R:G:B triplet,
135 each color value can range from 0-255. If not specified the de‐
136 fault line_color is black and the default fill_color is grey.
137
138 rotation angle
139 Subsequent text and symbols will be drawn such that they are ro‐
140 tated angle degrees counter-clockwise from east.
141
142 icon type size x y
143 Draws an icon of types o, x, or + with specified size (in %) at lo‐
144 cation x,y. Note: type o designates a square.
145
146 width value
147 Subsequent lines (including non-FreeType text) will be drawn with
148 the given pixel thickness.
149 The default value is 0.
150
152 For an example use of d.graph, examine the contents of the command file
153 grass_logo.txt located in the d.graph source code directory. It will
154 draw the CERL GRASS logo using the d.graph graphing commands stored in
155 the file. Note that the coordinates in the grass_logo.txt file were
156 taken directly off an image drawn by hand on graph paper.
157
158 A dynamic example can be found in the d.polar shell script.
159
160 Draw a "star" symbol at a given map coordinate
161 echo "symbol basic/star 20 2264417 5413182 black red" | d.graph -m
162
163 Split the screen into quadrants:
164 d.frame -s full_screen
165 d.graph << EOF
166 color 80:80:120
167 polygon
168 0 49.75
169 0 50.25
170 100 50.25
171 100 49.75
172 polygon
173 49.85 0
174 50.15 0
175 50.15 100
176 49.85 100
177 EOF
178
180 d.graph remembers the last screen location (xpos ypos) to which the
181 user moved, even after the user erases the display frame. If the user
182 runs d.graph repeatedly, and wishes to start anew with the default
183 (xpos ypos) screen location, the user should clear the display frame
184 between runs of d.graph.
185
187 There are no automated ways of generating graphic images. It is antici‐
188 pated that GRASS user sites will write programs to convert output from
189 a resident graphics editor into GRASS d.graph format. (e.g. EPS ->
190 d.graph, perhaps with the help of a pstoedit plugin)
191
193 d.font, d.labels, d.polar, d.text, d.where
194
196 James Westervelt, U.S. Army Construction Engineering Research Labora‐
197 tory
198
200 Available at: d.graph source code (history)
201
202 Accessed: Saturday Oct 28 18:17:13 2023
203
204 Main index | Display index | Topics index | Keywords index | Graphical
205 index | Full index
206
207 © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
208
209
210
211GRASS 8.3.1 d.graph(1)