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,
69           oranges,  plasma,  population, population_dens, precipitation, pre‐
70           cipitation_daily,  precipitation_monthly,  rainbow,  ramp,  random,
71           reds, 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
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            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,
189           basic/box, basic/circle, basic/cross1, basic/cross2,  basic/cross3,
190           basic/diamond,    basic/hexagon,    basic/marker,    basic/octagon,
191           basic/pin, basic/pin_dot, basic/point,  basic/pushpin,  basic/star,
192           basic/triangle,      basic/x,      demo/muchomurka,      demo/smrk,
193           extra/4pt_star,   extra/adcp,   extra/airport,    extra/alpha_flag,
194           extra/bridge,   extra/dim_arrow,  extra/dive_flag,  extra/fiducial,
195           extra/fish,  extra/half-box,  extra/half-circle,   extra/offbox_ne,
196           extra/offbox_nw,  extra/offbox_se, extra/offbox_sw, extra/pentagon,
197           extra/ping,  extra/ring,  extra/simple_zia,   extra/target,   geol‐
198           ogy/circle_cross,           geology/half-arrow_left,          geol‐
199           ogy/half-arrow_right,  geology/strike_box,   geology/strike_circle,
200           geology/strike_cleavage,      geology/strike_half-bowtie,     geol‐
201           ogy/strike_line, geology/strike_parallel,  geology/strike_triangle,
202           legend/area,  legend/area_curved, legend/line, legend/line_crooked,
203           n_arrows/basic_compass, n_arrows/fancy_compass, n_arrows/n_arrow1a,
204           n_arrows/n_arrow1b,      n_arrows/n_arrow2,      n_arrows/n_arrow3,
205           n_arrows/n_arrow4,      n_arrows/n_arrow5,       n_arrows/n_arrow6,
206           n_arrows/n_arrow7a,     n_arrows/n_arrow7b,     n_arrows/n_arrow8a,
207           n_arrows/n_arrow8b, n_arrows/n_arrow9
208           Default: basic/circle
209
210       point_size=float
211           Point size
212           Default: 5
213
214       secondary_color=name
215           Color
216           Color for point symbol edge color
217           Default: black
218
219       secondary_width=float[,float,...]
220           Width of point symbol lines
221           Default: 0.1
222

DESCRIPTION

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

NOTES

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

EXAMPLE

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

SEE ALSO

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

AUTHOR

346       Chris Rewerts, Agricultural Engineering, Purdue University
347

SOURCE CODE

349       Available at: d.linegraph source code (history)
350
351       Main  index | Display index | Topics index | Keywords index | Graphical
352       index | Full index
353
354       © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
355
356
357
358GRASS 7.8.5                                                     d.linegraph(1)
Impressum