1d.graph(1)                    Grass User's Manual                   d.graph(1)
2
3
4

NAME

6       d.graph  - Program for generating and displaying simple graphics on the
7       display monitor.
8

KEYWORDS

10       display
11

SYNOPSIS

13       d.graph
14       d.graph help
15       d.graph [-m]  [input=string]   [color=string]
16
17   Flags:
18       -m  Coordinates are given in map units
19
20   Parameters:
21       input=string
22           Name of file containing graphics commands, if not given reads  from
23           standard input
24
25       color=string
26           Color  to draw with, either a standard GRASS color or R:G:B triplet
27           Default: black
28

DESCRIPTION

30       d.graph draws graphics that are described either  from  standard  input
31       (default), or within a file (if an input file name is identified on the
32       command line). If graphics commands are entered from standard input,  a
33       CTRL-d  is used to signal the end of input to d.graph.  Coordinates are
34       given either as a percentage of frame height and width (default) or  in
35       geographic coordinates (with the -m flag).
36
37       The  program  can  be run interactively or non-interactively.  The user
38       can run the program completely non-interactively by specifying the name
39       of  a  graphics  file  containing the d.graph graphics commands. If run
40       non-interactively the d.graph command is saved to the display's  dedraw
41       history.  The user can also elect to run the program partially interac‐
42       tively, by specifying any/all of the  parameters  except  the  graphics
43       file  input=name  parameter on the command line.  In this case, d.graph
44       will expect the user to input d.graph graphics commands  from  standard
45       input  (i.e.,  the  keyboard)  and  will (silently) prompt the user for
46       these graphics commands.
47
48       Alternately, the user can simply type d.graph on the command line,  and
49       be prompted for the values of all parameters GRASS GUI interface.
50
51       The default coordinate system used is 0-100 percent of the active frame
52       in x and similarly 0-100 in y, regardless of the graphics monitor  dis‐
53       play  frame size and aspect.  The (0,0) location is the lower left cor‐
54       ner of the active graphics monitor display frame.  All  values  may  be
55       floating  point.   If the -m flag is given, geographic coordinates will
56       be used instead.
57

COMMANDS

59       The graphics language is simple, and uses the following commands:
60       [ # | move | draw | polygon | polyline | color | text | size | symbol |
61       rotation | icon | width ]
62
63       # comment
64              A line of comment which is ignored in the processing.
65
66       move xpos ypos
67              The  current  location  is  updated to xpos ypos.  Unless the -m
68              flag is used, values are stated as a percent of the active  dis‐
69              play frame's horizontal (xpos) and vertical (ypos) size, and may
70              be floating point values. Values are  between  0-100.   Note.  A
71              space must separate xpos and ypos.
72
73       draw xpos ypos
74              A  line  is drawn in the current color from the current location
75              to the new location xpos ypos, which then  becomes  the  current
76              location.   Unless  the  -m flag is used, values are stated as a
77              percent of the active display frame's horizontal (xpos) and ver‐
78              tical  (ypos) size, and may be floating point values. Values are
79              between 0-100.  Note. A space must separate xpos and ypos.
80
81       polygon
82                 xpos ypos
83                 xpos ypos
84                ...  The coordinates appearing beneath the word  polygon,  one
85              pair  per line, circumscribe a polygon that is to be filled with
86              the current color.
87
88       polyline
89                 xpos ypos
90                 xpos ypos
91                ...  The coordinates appearing beneath the word polyline,  one
92              pair  per  line, circumscribe a polygon that is not to be filled
93              with color.
94
95       color color
96              Sets the current color to that stated; subsequent graphics  will
97              be  drawn in the stated color, until the current color is set to
98              a different color.  Options  are  red,  orange,  yellow,  green,
99              blue,  indigo,  violet,  brown,  magenta, gray, white, black, an
100              R:G:B triplet (separated by colons), or the word  "none"  (draws
101              in the default background color).
102
103       text line-of-text
104              The  stated text is drawn at the current location using the cur‐
105              rent color, and the new current location is then  positioned  at
106              the end of the text string.
107
108       size xper yper
109              Subsequent text will be drawn such that the text is xper percent
110              of the graphics monitor display frame wide and yper  percent  of
111              the frame high. By default, the text size is set to 5 percent of
112              the active frame's width and 5 percent of  the  frame's  height.
113              If  only  one  value  is given, then that value will be used for
114              both x and y scaling.
115              Note. A space must separate xper and yper.
116
117       symbol type size xper yper line_color fill_color
118              A symbol is drawn at the given size on the display monitor.  The
119              xper  and  yper  options  define  the center of the icon and are
120              given as a percentage of the display frame (0,0 is lower  left).
121              The  symbol  can  be any of those stored in $GISBASE/etc/symbol/
122              (e.g. basic/circle) or stored in the user's mapset directory  in
123              the  form  $MAPSET/symbol/type/name.  The colors may be either a
124              standard color name, an R:G:B triplet, or "none".  If  using  an
125              R:G:B triplet, each color value can range from 0-255.
126
127       rotation angle
128              Subsequent  text  will  be  drawn  such that the text is rotated
129              angle degrees counter-clockwise from east.
130
131       icon type size x y
132              Draws an icon of types o, x, or + with specified size (in %)  at
133              location x,y.  Note: type o designates a square.
134
135       width value
136              Subsequent  lines  (including  non-FreeType  text) will be drawn
137              with the given pixel thickness.
138              The default value is 0.
139

EXAMPLES

141       For an example use of d.graph, examine the contents of the command file
142       grass_logo.txt  located  in  the d.graph source code directory. It will
143       draw the CERL GRASS logo using the d.graph graphing commands stored  in
144       the  file.   Note  that the coordinates in the grass_logo.txt file were
145       taken directly off an image drawn by hand on graph paper.
146
147       A dynamic example can be found in the d.polar shell script.
148
149   Draw a star symbol at a given map coordinate
150
151       echo "symbol basic/star 20 2264417 5413182 black red" | d.graph -m
152
153
154   Split the screen into quadrants:
155
156       d.frame -s full_screen
157       d.graph << EOF
158         color 80:80:120
159         polygon
160          0 49.75
161          0 50.25
162          100 50.25
163          100 49.75
164         polygon
165          49.85 0
166          50.15 0
167          50.15 100
168          49.85 100
169       EOF
170
171

NOTES

173       d.graph remembers the last screen location (xpos  ypos)  to  which  the
174       user  moved, even after the user erases the display frame.  If the user
175       runs d.graph repeatedly, and wishes to  start  anew  with  the  default
176       (xpos  ypos)  screen  location, the user should clear the display frame
177       between runs of d.graph.
178

LIMITATIONS

180       There are no automated ways of generating graphic images. It is antici‐
181       pated  that GRASS user sites will write programs to convert output from
182       a resident graphics editor into GRASS d.graph  format.   (e.g.  EPS  ->
183       d.graph)
184

SEE ALSO

186       d.font
187       d.font.freetype
188       d.frame
189       d.labels
190       d.polar
191       d.text
192       d.text.freetype
193       d.where
194

AUTHOR

196       James  Westervelt,  U.S. Army Construction Engineering Research Labora‐
197       tory
198       Last changed: $Date: 2006/09/13 13:41:48 $
199
200       Full index
201
202
203
204GRASS 6.2.2                                                         d.graph(1)
Impressum