1d.linegraph(1)                Grass 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           gdd, grass, greens, grey, grey.eq, grey.log, grey1.0, grey255, gyr,
68           haxby, kelvin, ndvi, ndwi,  oranges,  population,  population_dens,
69           precipitation, precipitation_daily, precipitation_monthly, rainbow,
70           ramp, random, reds, roygbiv, rstcurv, ryb, ryg, sepia, slope, soil‐
71           moisture, srtm, srtm_plus, terrain, viridis, water, wave
72            aspect: aspect oriented grey colors
73            aspectcolr: aspect oriented rainbow colors
74            bcyr: blue through cyan through yellow to red
75            bgyr: blue through green through yellow to red
76            blues: white to blue
77            byg: blue through yellow to green
78            byr: blue through yellow to red
79            celsius: blue to red for degree Celsius temperature
80            corine: EU Corine land cover colors
81            curvature:   for   terrain   curvatures   (from   v.surf.rst   and
82           r.slope.aspect)
83            differences: differences oriented colors
84            elevation: maps relative ranges  of  raster  values  to  elevation
85           color ramp
86            etopo2: colors for ETOPO2 worldwide bathymetry/topography
87            evi: enhanced vegetative index colors
88            fahrenheit: blue to red for Fahrenheit temperature
89            gdd: accumulated growing degree days
90            grass: GRASS GIS green (perceptually uniform)
91            greens: white to green
92            grey: grey scale
93            grey.eq: histogram-equalized grey scale
94            grey.log: histogram logarithmic transformed grey scale
95            grey1.0: grey scale for raster values between 0.0-1.0
96            grey255: grey scale for raster values between 0-255
97            gyr: green through yellow to red
98            haxby: relative colors for bathymetry or topography
99            kelvin: blue to red for temperature in Kelvin scale
100            ndvi: Normalized Difference Vegetation Index colors
101            ndwi: Normalized Difference Water Index colors
102            oranges: white to orange
103            population:  color  table covering human population classification
104           breaks
105            population_dens: color table  covering  human  population  density
106           classification breaks
107            precipitation: precipitation color table (0..2000mm)
108            precipitation_daily: precipitation color table (0..1000mm)
109            precipitation_monthly: precipitation color table (0..1000mm)
110            rainbow: rainbow color table
111            ramp: color ramp
112            random: random color table
113            reds: white to red
114            roygbiv: no description
115            rstcurv: terrain curvature (from r.resamp.rst)
116            ryb: red through yellow to blue
117            ryg: red through yellow to green
118            sepia: yellowish-brown through to white
119            slope: r.slope.aspect-type slope colors for raster values 0-90
120            soilmoisture: soilmoisture color table (0.0-1.0)
121            srtm: color palette for Shuttle Radar Topography Mission elevation
122            srtm_plus: color palette for Shuttle Radar Topography Mission ele‐
123           vation (with seafloor colors)
124            terrain: global elevation color table covering -11000 to +8850m
125            viridis: perceptually uniform sequential color table viridis
126            water: water depth
127            wave: color wave
128
129       width=integer[,integer,...]
130           Width of the lines
131
132       title_color=string
133           Color for axis, tics, numbers, and title
134           Default: black
135
136       x_title=string
137           Title for X data
138           Default:
139
140       y_title=string
141           Title for Y data
142           Default:
143
144       title=string
145           Title for Graph
146           Default:
147
148       y_range=min,max
149           Minimum and maximun value for Y axis (min,max)
150
151       y_tics=float[,float,...]
152           Tic values for the Y axis
153
154       x_scale=float
155           Scale for X values
156
157       y_scale=float
158           Scale for Y values
159
160       icon=string
161           Symbol for point
162           Options:  basic/arrow,  basic/arrow1,  basic/arrow2,  basic/arrow3,
163           basic/box,  basic/circle, basic/cross1, basic/cross2, basic/cross3,
164           basic/diamond,    basic/hexagon,    basic/marker,    basic/octagon,
165           basic/pin,  basic/pin_dot,  basic/point, basic/pushpin, basic/star,
166           basic/triangle,      basic/x,      demo/muchomurka,      demo/smrk,
167           extra/4pt_star,    extra/adcp,   extra/airport,   extra/alpha_flag,
168           extra/bridge,  extra/dim_arrow,  extra/dive_flag,   extra/fiducial,
169           extra/fish,   extra/half-box,  extra/half-circle,  extra/offbox_ne,
170           extra/offbox_nw, extra/offbox_se, extra/offbox_sw,  extra/pentagon,
171           extra/ping,   extra/ring,   extra/simple_zia,  extra/target,  geol‐
172           ogy/circle_cross,          geology/half-arrow_left,           geol‐
173           ogy/half-arrow_right,   geology/strike_box,  geology/strike_circle,
174           geology/strike_cleavage,     geology/strike_half-bowtie,      geol‐
175           ogy/strike_line,  geology/strike_parallel, geology/strike_triangle,
176           legend/area, legend/area_curved, legend/line,  legend/line_crooked,
177           n_arrows/basic_compass, n_arrows/fancy_compass, n_arrows/n_arrow1a,
178           n_arrows/n_arrow1b,      n_arrows/n_arrow2,      n_arrows/n_arrow3,
179           n_arrows/n_arrow4,       n_arrows/n_arrow5,      n_arrows/n_arrow6,
180           n_arrows/n_arrow7a,     n_arrows/n_arrow7b,     n_arrows/n_arrow8a,
181           n_arrows/n_arrow8b, n_arrows/n_arrow9
182           Default: basic/circle
183
184       point_size=float
185           Point size
186           Default: 5
187
188       secondary_color=name
189           Color
190           Color for point symbol edge color
191           Default: black
192
193       secondary_width=float[,float,...]
194           Width of point symbol lines
195           Default: 0.1
196

DESCRIPTION

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

NOTES

264       For  historical  reasons, the d.linegraph module accepts titles of more
265       than one word where the underscore character ("_") is used to represent
266       spaces  (" "). For example "Census_data_1990" would be printed over the
267       graph as "Census data 1990". The use of underscores is not necessary to
268       use  as  long  as the parameter is quoted in the command line.  In gen‐
269       eral, use of underscores is not recommended and there is no need to use
270       it at all in the GUI or when using d.linegraph in Python scripts.
271
272       The way the program locates and labels tic marks is less than perfect:
273       1)  although  distances  between  Y tics are proportional to the value,
274       they are not proportional on the X axis;
275       2) decimal values between -1 and 1 can be printed on the  X  axis,  but
276       not on Y. (With respect to the later, the input for Y values can all be
277       multiplied by a factor of 10 before graphing).
278
279       Depending on the user’s needs, it might be easier or  more  appropriate
280       to  use a 3rd party tool such as xgraph, gnuplot, Matplotlib in Python,
281       or R instead of d.linegraph.  For a more general solution for  plotting
282       in GRASS GIS, the user is advised to use the d.graph module.
283

EXAMPLE

285       The following can be executed in Bash to create the input data for this
286       example. The user can just create these files in a  text  editor,  save
287       them and specify path to them.
288       cat > x.txt <<EOF
289       1
290       3
291       4
292       6
293       9
294       EOF
295       cat > y1.txt <<EOF
296       50
297       58
298       65
299       34
300       27
301       EOF
302       cat > y2.txt <<EOF
303       10
304       20
305       35
306       50
307       45
308       EOF
309
310       The next command sequence creates a file plot.png in the current direc‐
311       tory which is the drawing made by d.linegraph.
312       d.mon start=cairo output=plot.png width=400 height=400
313       d.linegraph x_file=x.txt y_file=y1.txt,y2.txt
314       d.mon stop=cairo
315

SEE ALSO

317        d.frame, d.text, v.label, d.graph, d.histogram
318

AUTHOR

320       Chris Rewerts, Agricultural Engineering, Purdue University
321
322       Last changed: $Date: 2017-02-02 10:10:41 +0100 (Thu, 02 Feb 2017) $
323

SOURCE CODE

325       Available at: d.linegraph source code (history)
326
327       Main index | Display index | Topics index | Keywords index |  Graphical
328       index | Full index
329
330       © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
331
332
333
334GRASS 7.4.4                                                     d.linegraph(1)
Impressum