1d.graph(1) Grass 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=string] [color=string] [--verbose] [--quiet]
16
17 Flags:
18 -m
19 Coordinates are given in map units
20
21 --verbose
22 Verbose module output
23
24 --quiet
25 Quiet module output
26
27 Parameters:
28 input=string
29 Name of file containing graphics commands, if not given reads from
30 standard input
31
32 color=string
33 Color to draw with, either a standard GRASS color or R:G:B triplet
34 Default: black
35
37 d.graph draws graphics that are described either from standard input
38 (default), or within a file (if an input file name is identified on the
39 command line). If graphics commands are entered from standard input, a
40 CTRL-d is used to signal the end of input to d.graph. Coordinates are
41 given either as a percentage of frame height and width (default) or in
42 geographic coordinates (with the -m flag).
43
44 The program can be run interactively or non-interactively. The user
45 can run the program completely non-interactively by specifying the name
46 of a graphics file containing the d.graph graphics commands. If run
47 non-interactively the d.graph command is saved to the display's dedraw
48 history. The user can also elect to run the program partially interac‐
49 tively, by specifying any/all of the parameters except the graphics
50 file input=name parameter on the command line. In this case, d.graph
51 will expect the user to input d.graph graphics commands from standard
52 input (i.e., the keyboard) and will (silently) prompt the user for
53 these graphics commands.
54
55 Alternately, the user can simply type d.graph on the command line, and
56 be prompted for the values of all parameters GRASS GUI interface.
57
58 The default coordinate system used is 0-100 percent of the active frame
59 in x and similarly 0-100 in y, regardless of the graphics monitor dis‐
60 play frame size and aspect. The (0,0) location is the lower left cor‐
61 ner of the active graphics monitor display frame. All values may be
62 floating point. If the -m flag is given, geographic coordinates will
63 be used instead.
64
66 The graphics language is simple, and uses the following commands:
67 [ # | move | draw | polygon | polyline | color | text | size | symbol |
68 rotation | icon | width ]
69
70 # comment
71 A line of comment which is ignored in the processing.
72
73 move xpos ypos
74 The current location is updated to xpos ypos. Unless the -m
75 flag is used, values are stated as a percent of the active dis‐
76 play frame's horizontal (xpos) and vertical (ypos) size, and may
77 be floating point values. Values are between 0-100. Note. A
78 space must separate xpos and ypos.
79
80 draw xpos ypos
81 A line is drawn in the current color from the current location
82 to the new location xpos ypos, which then becomes the current
83 location. Unless the -m flag is used, values are stated as a
84 percent of the active display frame's horizontal (xpos) and ver‐
85 tical (ypos) size, and may be floating point values. Values are
86 between 0-100. Note. A space must separate xpos and ypos.
87
88 polygon
89 xpos ypos
90 xpos ypos
91 ...
92 The coordinates appearing beneath the word polygon, one pair per
93 line, circumscribe a polygon that is to be filled with the cur‐
94 rent color.
95
96 polyline
97 xpos ypos
98 xpos ypos
99 ...
100 The coordinates appearing beneath the word polyline, one pair
101 per line, circumscribe a polygon that is not to be filled with
102 color.
103
104 color color
105 Sets the current color to that stated; subsequent graphics will
106 be drawn in the stated color, until the current color is set to
107 a different color. Options are red, orange, yellow, green,
108 blue, indigo, violet, brown, magenta, gray, white, black, an
109 R:G:B triplet (separated by colons), or the word "none" (draws
110 in the default background color).
111
112 text line-of-text
113 The stated text is drawn at the current location using the cur‐
114 rent color, and the new current location is then positioned at
115 the end of the text string.
116
117 size xper yper
118 Subsequent text will be drawn such that the text is xper percent
119 of the graphics monitor display frame wide and yper percent of
120 the frame high. By default, the text size is set to 5 percent of
121 the active frame's width and 5 percent of the frame's height.
122 If only one value is given, then that value will be used for
123 both x and y scaling.
124 Note. A space must separate xper and yper.
125
126 symbol type size xper yper [line_color [fill_color]]
127 A symbol is drawn at the given size on the display monitor. The
128 xper and yper options define the center of the icon and are
129 given as a percentage of the display frame (0,0 is lower left).
130 The symbol can be any of those stored in $GISBASE/etc/symbol/
131 (e.g. basic/circle) or stored in the user's mapset directory in
132 the form $MAPSET/symbol/type/name. The colors may be either a
133 standard color name, an R:G:B triplet, or "none". If using an
134 R:G:B triplet, each color value can range from 0-255. If not
135 specified the default line_color is black and the default
136 fill_color is grey.
137
138 rotation angle
139 Subsequent text and symbols will be drawn such that they are
140 rotated 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
144 location x,y. Note: type o designates a square.
145
146 width value
147 Subsequent lines (including non-FreeType text) will be drawn
148 with 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
162 echo "symbol basic/star 20 2264417 5413182 black red" | d.graph -m
163
164
165 Split the screen into quadrants:
166
167 d.frame -s full_screen
168 d.graph << EOF
169 color 80:80:120
170 polygon
171 0 49.75
172 0 50.25
173 100 50.25
174 100 49.75
175 polygon
176 49.85 0
177 50.15 0
178 50.15 100
179 49.85 100
180 EOF
181
182
184 d.graph remembers the last screen location (xpos ypos) to which the
185 user moved, even after the user erases the display frame. If the user
186 runs d.graph repeatedly, and wishes to start anew with the default
187 (xpos ypos) screen location, the user should clear the display frame
188 between runs of d.graph.
189
191 There are no automated ways of generating graphic images. It is antici‐
192 pated that GRASS user sites will write programs to convert output from
193 a resident graphics editor into GRASS d.graph format. (e.g. EPS ->
194 d.graph)
195
197 d.font
198 d.font.freetype
199 d.frame
200 d.labels
201 d.polar
202 d.text
203 d.text.freetype
204 d.where
205
207 James Westervelt, U.S. Army Construction Engineering Research Labora‐
208 tory
209 Last changed: $Date: 2007-05-21 10:32:44 +0200 (Mon, 21 May 2007) $
210
211 Full index
212
213 © 2003-2008 GRASS Development Team
214
215
216
217GRASS 6.3.0 d.graph(1)