1d.linegraph(1) Grass User's Manual d.linegraph(1)
2
3
4
6 d.linegraph - Generates and displays simple line graphs in the active
7 graphics monitor display frame.
8
10 display, cartography
11
13 d.linegraph
14 d.linegraph --help
15 d.linegraph [-xysl] x_file=string y_file=string[,string,...] [direc‐
16 tory=string] [y_color=string[,string,...]] [color_table=style]
17 [width=integer[,integer,...]] [title_color=string] [x_title=string]
18 [y_title=string] [title=string] [y_range=min,max]
19 [y_tics=float[,float,...]] [x_scale=float] [y_scale=float]
20 [icon=string] [point_size=float] [secondary_color=name] [sec‐
21 ondary_width=float[,float,...]] [--help] [--verbose] [--quiet]
22 [--ui]
23
24 Flags:
25 -x
26 Scale only X labels, not values
27
28 -y
29 Scale only Y labels, not values
30
31 -s
32 Draw points
33
34 -l
35 Do not draw lines
36
37 --help
38 Print usage summary
39
40 --verbose
41 Verbose module output
42
43 --quiet
44 Quiet module output
45
46 --ui
47 Force launching GUI dialog
48
49 Parameters:
50 x_file=string [required]
51 Name of data file for X axis of graph
52
53 y_file=string[,string,...]Â [required]
54 Name of data file(s) for Y axis of graph
55
56 directory=string
57 Path to files
58 Path to the directory where the input files are located
59
60 y_color=string[,string,...]
61 Color for Y data
62
63 color_table=style
64 Name of color table
65 Options: aspect, aspectcolr, bcyr, bgyr, blues, byg, byr, celsius,
66 corine, curvature, differences, elevation, etopo2, evi, fahrenheit,
67 gdd, grass, greens, grey, grey.eq, grey.log, grey1.0, grey255, gyr,
68 haxby, inferno, kelvin, magma, ndvi, ndwi, oranges, plasma, popula‐
69 tion, population_dens, precipitation, precipitation_daily, precipi‐
70 tation_monthly, rainbow, ramp, random, reds, roygbiv, rstcurv, ryb,
71 ryg, sepia, slope, soilmoisture, srtm, srtm_plus, terrain, viridis,
72 water, wave
73 aspect: aspect oriented grey colors [range: map values]
74 aspectcolr: aspect oriented rainbow colors [range: 0 to 360]
75 bcyr: blue through cyan through yellow to red [range: map values]
76 bgyr: blue through green through yellow to red [range: map values]
77 blues: white to blue [range: map values]
78 byg: blue through yellow to green [range: map values]
79 byr: blue through yellow to red [range: map values]
80 celsius: blue to red for degree Celsius temperature [range: -80 to
81 80]
82 corine: EU Corine land cover colors [range: 111 to 995]
83 curvature: for terrain curvatures (from v.surf.rst and
84 r.slope.aspect) [range: map values]
85 differences: differences oriented colors [range: map values]
86 elevation: maps relative ranges of raster values to elevation
87 color ramp [range: map values]
88 etopo2: colors for ETOPO2 worldwide bathymetry/topography [range:
89 -11000 to 8850]
90 evi: enhanced vegetative index colors [range: -1 to 1]
91 fahrenheit: blue to red for Fahrenheit temperature [range: -112 to
92 176]
93 gdd: accumulated growing degree days [range: 0 to 6000]
94 grass: GRASS GIS green (perceptually uniform) [range: map values]
95 greens: white to green [range: map values]
96 grey: grey scale [range: map values]
97 grey.eq: histogram-equalized grey scale [range: map values]
98 grey.log: histogram logarithmic transformed grey scale [range: map
99 values]
100 grey1.0: grey scale for raster values between 0.0-1.0 [range: 0 to
101 1]
102 grey255: grey scale for raster values between 0-255 [range: 0 to
103 255]
104 gyr: green through yellow to red [range: map values]
105 haxby: relative colors for bathymetry or topography [range: map
106 values]
107 inferno: perceptually uniform sequential color table inferno
108 [range: map values]
109 kelvin: blue to red for temperature in Kelvin scale [range: 193.15
110 to 353.15]
111 magma: perceptually uniform sequential color table magma [range:
112 map values]
113 ndvi: Normalized Difference Vegetation Index colors [range: -1 to
114 1]
115 ndwi: Normalized Difference Water Index colors [range: -200 to
116 200]
117 oranges: white to orange [range: map values]
118 plasma: perceptually uniform sequential color table plasma [range:
119 map values]
120 population: color table covering human population classification
121 breaks [range: 0 to 2e+09]
122 population_dens: color table covering human population density
123 classification breaks [range: 0 to 1e+09]
124 precipitation: precipitation color table (0..2000mm) [range: 0 to
125 7000]
126 precipitation_daily: precipitation color table (0..1000mm) [range:
127 0 to 10000]
128 precipitation_monthly: precipitation color table (0..1000mm)
129 [range: 0 to 1000]
130 rainbow: rainbow color table [range: map values]
131 ramp: color ramp [range: map values]
132 random: random color table [range: map values]
133 reds: white to red [range: map values]
134 roygbiv: [range: map values]
135 rstcurv: terrain curvature (from r.resamp.rst) [range: map values]
136 ryb: red through yellow to blue [range: map values]
137 ryg: red through yellow to green [range: map values]
138 sepia: yellowish-brown through to white [range: map values]
139 slope: r.slope.aspect-type slope colors for raster values 0-90
140 [range: 0 to 90]
141 soilmoisture: soilmoisture color table (0.0-1.0) [range: 0 to 1]
142 srtm: color palette for Shuttle Radar Topography Mission elevation
143 [range: -11000 to 8850]
144 srtm_plus: color palette for Shuttle Radar Topography Mission ele‐
145 vation (with seafloor colors) [range: -11000 to 8850]
146 terrain: global elevation color table covering -11000 to +8850m
147 [range: -11000 to 8850]
148 viridis: perceptually uniform sequential color table viridis
149 [range: map values]
150 water: water depth [range: map values]
151 wave: color wave [range: map values]
152
153 width=integer[,integer,...]
154 Width of the lines
155
156 title_color=string
157 Color for axis, tics, numbers, and title
158 Default: black
159
160 x_title=string
161 Title for X data
162 Default:
163
164 y_title=string
165 Title for Y data
166 Default:
167
168 title=string
169 Title for Graph
170 Default:
171
172 y_range=min,max
173 Minimum and maximun value for Y axis (min,max)
174
175 y_tics=float[,float,...]
176 Tic values for the Y axis
177
178 x_scale=float
179 Scale for X values
180
181 y_scale=float
182 Scale for Y values
183
184 icon=string
185 Symbol for point
186 Options: basic/arrow, basic/arrow1, basic/arrow2, basic/arrow3,
187 basic/box, basic/circle, basic/cross1, basic/cross2, basic/cross3,
188 basic/diamond, basic/hexagon, basic/marker, basic/octagon,
189 basic/pin, basic/pin_dot, basic/point, basic/pushpin, basic/star,
190 basic/triangle, basic/x, demo/muchomurka, demo/smrk,
191 extra/4pt_star, extra/adcp, extra/airport, extra/alpha_flag,
192 extra/bridge, extra/dim_arrow, extra/dive_flag, extra/fiducial,
193 extra/fish, extra/half-box, extra/half-circle, extra/offbox_ne,
194 extra/offbox_nw, extra/offbox_se, extra/offbox_sw, extra/pentagon,
195 extra/ping, extra/ring, extra/simple_zia, extra/target, geol‐
196 ogy/circle_cross, geology/half-arrow_left, geol‐
197 ogy/half-arrow_right, geology/strike_box, geology/strike_circle,
198 geology/strike_cleavage, geology/strike_half-bowtie, geol‐
199 ogy/strike_line, geology/strike_parallel, geology/strike_triangle,
200 legend/area, legend/area_curved, legend/line, legend/line_crooked,
201 n_arrows/basic_compass, n_arrows/fancy_compass, n_arrows/n_arrow1a,
202 n_arrows/n_arrow1b, n_arrows/n_arrow2, n_arrows/n_arrow3,
203 n_arrows/n_arrow4, n_arrows/n_arrow5, n_arrows/n_arrow6,
204 n_arrows/n_arrow7a, n_arrows/n_arrow7b, n_arrows/n_arrow8a,
205 n_arrows/n_arrow8b, n_arrows/n_arrow9
206 Default: basic/circle
207
208 point_size=float
209 Point size
210 Default: 5
211
212 secondary_color=name
213 Color
214 Color for point symbol edge color
215 Default: black
216
217 secondary_width=float[,float,...]
218 Width of point symbol lines
219 Default: 0.1
220
222 d.linegraph is a module to draw simple x,y line graphs (plots) based on
223 numerical data contained in separate files.
224
225 Data format
226 The X and Y data files for the graph are essentially a column of num‐
227 bers in each file, with one input number per line. The program expects
228 that each X value will have a corresponding Y value, therefore the num‐
229 ber of lines in each data input file should be the same. Essentially,
230 the X data becomes the X axis reference to which the Y data is plotted
231 as a line. Therefore, the X data should be a monotonically increasing
232 progression of numbers (i.e. "1,2,3,..."; "0, 10, 100, 1000,...";
233 "...-5,-1,0,1,5..."). If multiple Y data files are used, the Y axis
234 scale will be based on the range of minimum and maximum values from all
235 Y files, then all Y data given will be graphed according to that Y
236 scale. Therefore, if multiple Y data inputs are used with dissimilar
237 units, the graph produced comparing the two will be deceptive.
238
239 File inputs
240 If the directory option is provided, the paths to files can (and
241 should) be only relative paths to these files. While this is not recom‐
242 mended for scripting, it can be advantageous when typing the paths man‐
243 ually. For example when all files are stored in the directory
244 /home/john/data, the user can provide the following in the command
245 line:
246 d.linegraph directory=/home/john/data x_file=x.txt y_file=y1.txt,y2.txt
247
248 Managing colors
249 The user can specify the y_color option, the color_table option or just
250 leave the defaults to influence the color of the plotted lines.
251
252 Colors specified by y_color option are used for drawing the lines in
253 the graph. If multiple Y data files are used, an equal number of colors
254 may be used to control the colors of the lines. Colors will be assigned
255 to Y data in respect to the sequence of instantiation on the command
256 line. It can be one of GRASS GIS named colors or the RGB values from
257 0-255 separated by colons (RRR:GGG:BBB).
258
259 Alternatively, the user can use the color_table option to specify one
260 of the GRASS GIS predefined color tables.
261
262 By default, a series of colors will be chosen by the module if none are
263 provided upon invocation. The order of default colors is red, green,
264 violet, blue, orange, gray, brown, magenta, white, and indigo. The user
265 is advised not to rely on the order of default colors but to either use
266 the y_color or the color_table option to obtain predictable and repro‐
267 ducible results.
268
269 The color to be used for titles, axis lines, tics, and scale numbers is
270 determined by the title_color option. The user can provide one of the
271 GRASS GIS named colors (such as gray, white, or black) or use the GRASS
272 GIS colon-separated format for RGB (RRR:GGG:BBB).
273
274 Titles, labels, and tics
275 The title option specifies the text for the title of the graph. It
276 will be centered over the top of graph. The x_title option is a text
277 to describe data for X axis. It will be centered beneath the graph.
278 Default is no text unless there is a need for a unit descriptor deter‐
279 mined by the d.linegraph module, then string such as "in hundreds" is
280 generated. The y_title option is a text to describe data for Y axis.
281 It will be centered beneath the X data description. Similarly, to the
282 x_title option, default is no text unless there is a need for an
283 auto-generated description. In the case of graphs with multiple lines
284 (multiple inputs for Y axis), user may wish to use more specific text
285 placement using the d.text or v.label programs.
286
288 For historical reasons, the d.linegraph module accepts titles of more
289 than one word where the underscore character ("_") is used to represent
290 spaces (" "). For example "Census_data_1990" would be printed over the
291 graph as "Census data 1990". The use of underscores is not necessary to
292 use as long as the parameter is quoted in the command line. In gen‐
293 eral, use of underscores is not recommended and there is no need to use
294 it at all in the GUI or when using d.linegraph in Python scripts.
295
296 The way the program locates and labels tic marks is less than perfect:
297 1) although distances between Y tics are proportional to the value,
298 they are not proportional on the X axis;
299 2) decimal values between -1 and 1 can be printed on the X axis, but
300 not on Y. (With respect to the later, the input for Y values can all be
301 multiplied by a factor of 10 before graphing).
302
303 Depending on the user’s needs, it might be easier or more appropriate
304 to use a 3rd party tool such as xgraph, gnuplot, Matplotlib in Python,
305 or R instead of d.linegraph. For a more general solution for plotting
306 in GRASS GIS, the user is advised to use the d.graph module.
307
309 The following can be executed in Bash to create the input data for this
310 example. The user can just create these files in a text editor, save
311 them and specify path to them.
312 cat > x.txt <<EOF
313 1
314 3
315 4
316 6
317 9
318 EOF
319 cat > y1.txt <<EOF
320 50
321 58
322 65
323 34
324 27
325 EOF
326 cat > y2.txt <<EOF
327 10
328 20
329 35
330 50
331 45
332 EOF
333
334 The next command sequence creates a file plot.png in the current direc‐
335 tory which is the drawing made by d.linegraph.
336 d.mon start=cairo output=plot.png width=400 height=400
337 d.linegraph x_file=x.txt y_file=y1.txt,y2.txt
338 d.mon stop=cairo
339
341 d.frame, d.text, v.label, d.graph, d.histogram
342
344 Chris Rewerts, Agricultural Engineering, Purdue University
345
347 Available at: d.linegraph source code (history)
348
349 Main index | Display index | Topics index | Keywords index | Graphical
350 index | Full index
351
352 © 2003-2019 GRASS Development Team, GRASS GIS 7.8.2 Reference Manual
353
354
355
356GRASS 7.8.2 d.linegraph(1)