1d.linegraph(1)              GRASS GIS User's Manual             d.linegraph(1)
2
3
4

NAME

6       d.linegraph   - Generates and displays simple line graphs in the active
7       graphics monitor display frame.
8

KEYWORDS

10       display, cartography
11

SYNOPSIS

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           forest_cover, gdd, grass, greens, grey, grey.eq, grey.log, grey1.0,
68           grey255, gyr, haxby, inferno, kelvin, magma, ndvi, ndwi, nlcd,  or‐
69           anges, plasma, population, population_dens, precipitation, precipi‐
70           tation_daily, precipitation_monthly, rainbow, ramp,  random,  reds,
71           roygbiv,  rstcurv,  ryb,  ryg,  sepia,  slope,  soilmoisture, srtm,
72           srtm_plus, terrain, viridis, 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 r.slope.as‐
84           pect) [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            forest_cover: percentage of forest cover [range: 0 to 100]
94            gdd: accumulated growing degree days [range: 0 to 6000]
95            grass: GRASS GIS green (perceptually uniform) [range: map values]
96            greens: white to green [range: map values]
97            grey: grey scale [range: map values]
98            grey.eq: histogram-equalized grey scale [range: map values]
99            grey.log: histogram logarithmic transformed grey scale [range: map
100           values]
101            grey1.0: grey scale for raster values between 0.0-1.0 [range: 0 to
102           1]
103            grey255:  grey  scale for raster values between 0-255 [range: 0 to
104           255]
105            gyr: green through yellow to red [range: map values]
106            haxby: relative colors for bathymetry or  topography  [range:  map
107           values]
108            inferno:  perceptually  uniform  sequential  color  table  inferno
109           [range: map values]
110            kelvin: blue to red for temperature in Kelvin scale [range: 193.15
111           to 353.15]
112            magma:  perceptually  uniform sequential color table magma [range:
113           map values]
114            ndvi: Normalized Difference Vegetation Index colors [range: -1  to
115           1]
116            ndwi:  Normalized  Difference  Water  Index colors [range: -200 to
117           200]
118            nlcd: US National Land Cover Dataset colors [range: 0 to 95]
119            oranges: white to orange [range: map values]
120            plasma: perceptually uniform sequential color table plasma [range:
121           map values]
122            population:  color  table covering human population classification
123           breaks [range: 0 to 2e+09]
124            population_dens: color table  covering  human  population  density
125           classification breaks [range: 0 to 1e+09]
126            precipitation:  precipitation color table (0..2000mm) [range: 0 to
127           7000]
128            precipitation_daily: precipitation color table (0..1000mm) [range:
129           0 to 10000]
130            precipitation_monthly:   precipitation   color  table  (0..1000mm)
131           [range: 0 to 1000]
132            rainbow: rainbow color table [range: map values]
133            ramp: color ramp [range: map values]
134            random: random color table [range: map values]
135            reds: white to red [range: map values]
136            roygbiv:  [range: map values]
137            rstcurv: terrain curvature (from r.resamp.rst) [range: map values]
138            ryb: red through yellow to blue [range: map values]
139            ryg: red through yellow to green [range: map values]
140            sepia: yellowish-brown through to white [range: map values]
141            slope: r.slope.aspect-type slope colors  for  raster  values  0-90
142           [range: 0 to 90]
143            soilmoisture: soilmoisture color table (0.0-1.0) [range: 0 to 1]
144            srtm: color palette for Shuttle Radar Topography Mission elevation
145           [range: -11000 to 8850]
146            srtm_plus: color palette for Shuttle Radar Topography Mission ele‐
147           vation (with seafloor colors) [range: -11000 to 8850]
148            terrain:  global  elevation  color table covering -11000 to +8850m
149           [range: -11000 to 8850]
150            viridis:  perceptually  uniform  sequential  color  table  viridis
151           [range: map values]
152            water: water depth [range: map values]
153            wave: color wave [range: map values]
154
155       width=integer[,integer,...]
156           Width of the lines
157
158       title_color=string
159           Color for axis, tics, numbers, and title
160           Default: black
161
162       x_title=string
163           Title for X data
164           Default:
165
166       y_title=string
167           Title for Y data
168           Default:
169
170       title=string
171           Title for Graph
172           Default:
173
174       y_range=min,max
175           Minimum and maximun value for Y axis (min,max)
176
177       y_tics=float[,float,...]
178           Tic values for the Y axis
179
180       x_scale=float
181           Scale for X values
182
183       y_scale=float
184           Scale for Y values
185
186       icon=string
187           Symbol for point
188           Options: basic/arrow, basic/arrow1, basic/arrow2, basic/arrow3, ba‐
189           sic/box, basic/circle,  basic/cross1,  basic/cross2,  basic/cross3,
190           basic/diamond,   basic/hexagon,  basic/marker,  basic/octagon,  ba‐
191           sic/pin, basic/pin_dot, basic/point, basic/pushpin, basic/star, ba‐
192           sic/triangle,  basic/x, demo/muchomurka, demo/smrk, extra/4pt_star,
193           extra/adcp,  extra/airport,  extra/alpha_flag,  extra/bridge,   ex‐
194           tra/dim_arrow,  extra/dive_flag,  extra/fiducial,  extra/fish,  ex‐
195           tra/half-box, extra/half-circle, extra/offbox_ne,  extra/offbox_nw,
196           extra/offbox_se,  extra/offbox_sw,  extra/pentagon, extra/ping, ex‐
197           tra/ring, extra/simple_zia, extra/target, geology/circle_cross, ge‐
198           ology/half-arrow_left,        geology/half-arrow_right,       geol‐
199           ogy/strike_box, geology/strike_circle, geology/strike_cleavage, ge‐
200           ology/strike_half-bowtie,  geology/strike_line, geology/strike_par‐
201           allel,  geology/strike_triangle,  legend/area,  legend/area_curved,
202           legend/line,   legend/line_crooked,  n_arrows/basic_compass,  n_ar‐
203           rows/fancy_compass, n_arrows/n_arrow1a,  n_arrows/n_arrow1b,  n_ar‐
204           rows/n_arrow2, n_arrows/n_arrow3, n_arrows/n_arrow4, n_arrows/n_ar‐
205           row5,  n_arrows/n_arrow6,  n_arrows/n_arrow7a,  n_arrows/n_arrow7b,
206           n_arrows/n_arrow8a, n_arrows/n_arrow8b, n_arrows/n_arrow9
207           Default: basic/circle
208
209       point_size=float
210           Point size
211           Default: 5
212
213       secondary_color=name
214           Color
215           Color for point symbol edge color
216           Default: black
217
218       secondary_width=float[,float,...]
219           Width of point symbol lines
220           Default: 0.1
221

DESCRIPTION

223       d.linegraph is a module to draw simple x,y line graphs (plots) based on
224       numerical data contained in separate files.
225
226   Data format
227       The X and Y data files for the graph are essentially a column  of  num‐
228       bers in each file, with one input number per line.  The program expects
229       that each X value will have a corresponding Y value, therefore the num‐
230       ber  of lines in each data input file should be the same.  Essentially,
231       the X data becomes the X axis reference to which the Y data is  plotted
232       as  a  line. Therefore, the X data should be a monotonically increasing
233       progression of numbers (i.e.   "1,2,3,...";  "0,  10,  100,  1000,...";
234       "...-5,-1,0,1,5...").   If  multiple  Y data files are used, the Y axis
235       scale will be based on the range of minimum and maximum values from all
236       Y  files,  then  all  Y  data given will be graphed according to that Y
237       scale. Therefore, if multiple Y data inputs are  used  with  dissimilar
238       units, the graph produced comparing the two will be deceptive.
239
240   File inputs
241       If  the  directory  option  is  provided,  the  paths to files can (and
242       should) be only relative paths to these files. While this is not recom‐
243       mended for scripting, it can be advantageous when typing the paths man‐
244       ually.  For  example  when  all  files  are  stored  in  the  directory
245       /home/john/data,  the  user  can  provide  the following in the command
246       line:
247       d.linegraph directory=/home/john/data x_file=x.txt y_file=y1.txt,y2.txt
248
249   Managing colors
250       The user can specify the y_color option, the color_table option or just
251       leave the defaults to influence the color of the plotted lines.
252
253       Colors  specified  by  y_color option are used for drawing the lines in
254       the graph. If multiple Y data files are used, an equal number of colors
255       may be used to control the colors of the lines. Colors will be assigned
256       to Y data in respect to the sequence of instantiation  on  the  command
257       line.  It  can  be one of GRASS GIS named colors or the RGB values from
258       0-255 separated by colons (RRR:GGG:BBB).
259
260       Alternatively, the user can use the color_table option to  specify  one
261       of the GRASS GIS predefined color tables.
262
263       By default, a series of colors will be chosen by the module if none are
264       provided upon invocation. The order of default colors  is  red,  green,
265       violet, blue, orange, gray, brown, magenta, white, and indigo. The user
266       is advised not to rely on the order of default colors but to either use
267       the  y_color or the color_table option to obtain predictable and repro‐
268       ducible results.
269
270       The color to be used for titles, axis lines, tics, and scale numbers is
271       determined  by  the title_color option. The user can provide one of the
272       GRASS GIS named colors (such as gray, white, or black) or use the GRASS
273       GIS colon-separated format for RGB (RRR:GGG:BBB).
274
275   Titles, labels, and tics
276       The  title  option  specifies  the text for the title of the graph.  It
277       will be centered over the top of graph.  The x_title option is  a  text
278       to describe data for X axis. It will be centered beneath the graph. De‐
279       fault is no text unless there is a need for a  unit  descriptor  deter‐
280       mined  by  the d.linegraph module, then string such as "in hundreds" is
281       generated.  The y_title option is a text to describe data for  Y  axis.
282       It  will  be centered beneath the X data description. Similarly, to the
283       x_title option, default is no text  unless  there  is  a  need  for  an
284       auto-generated  description.  In the case of graphs with multiple lines
285       (multiple inputs for Y axis), user may wish to use more  specific  text
286       placement using the d.text or v.label programs.
287

NOTES

289       For  historical  reasons, the d.linegraph module accepts titles of more
290       than one word where the underscore character ("_") is used to represent
291       spaces  (" "). For example "Census_data_1990" would be printed over the
292       graph as "Census data 1990". The use of underscores is not necessary to
293       use  as  long  as the parameter is quoted in the command line.  In gen‐
294       eral, use of underscores is not recommended and there is no need to use
295       it at all in the GUI or when using d.linegraph in Python scripts.
296
297       The way the program locates and labels tic marks is less than perfect:
298       1)  although  distances  between  Y tics are proportional to the value,
299       they are not proportional on the X axis;
300       2) decimal values between -1 and 1 can be printed on the  X  axis,  but
301       not on Y. (With respect to the later, the input for Y values can all be
302       multiplied by a factor of 10 before graphing).
303
304       Depending on the user’s needs, it might be easier or  more  appropriate
305       to  use a 3rd party tool such as xgraph, gnuplot, Matplotlib in Python,
306       or R instead of d.linegraph.  For a more general solution for  plotting
307       in GRASS GIS, the user is advised to use the d.graph module.
308

EXAMPLE

310       The following can be executed in Bash to create the input data for this
311       example. The user can just create these files in a  text  editor,  save
312       them and specify path to them.
313       cat > x.txt <<EOF
314       1
315       3
316       4
317       6
318       9
319       EOF
320       cat > y1.txt <<EOF
321       50
322       58
323       65
324       34
325       27
326       EOF
327       cat > y2.txt <<EOF
328       10
329       20
330       35
331       50
332       45
333       EOF
334
335       The next command sequence creates a file plot.png in the current direc‐
336       tory which is the drawing made by d.linegraph.
337       d.mon start=cairo output=plot.png width=400 height=400
338       d.linegraph x_file=x.txt y_file=y1.txt,y2.txt
339       d.mon stop=cairo
340

SEE ALSO

342        d.frame, d.text, v.label, d.graph, d.histogram
343

AUTHOR

345       Chris Rewerts, Agricultural Engineering, Purdue University
346

SOURCE CODE

348       Available at: d.linegraph source code (history)
349
350       Accessed: Saturday Jan 21 20:38:06 2023
351
352       Main index | Display index | Topics index | Keywords index |  Graphical
353       index | Full index
354
355       © 2003-2023 GRASS Development Team, GRASS GIS 8.2.1 Reference Manual
356
357
358
359GRASS 8.2.1                                                     d.linegraph(1)
Impressum