d.linegraph(1grass)

πŸ¦‹ d.linegraph πŸ¦‹

so this is the d.linegraph page from the GRASS User's Manual (section 1grass), and bestie, it's literally how you make cute little line graphs show up in your graphics monitor. let's get into it πŸ’…


✨ NAME ✨

d.linegraph β€” generates and displays simple line graphs in the active graphics monitor display frame. that's it, that's the gig 🫢


πŸŽ€ KEYWORDS πŸŽ€

display, cartography


🌈 SYNOPSIS 🌈

d.linegraph
d.linegraph --help
d.linegraph [-xysl] x_file=string y_file=string[,string,...]
[directory=string]   [y_color=string[,string,...]]   [color_table=style]
[width=integer[,integer,...]]   [title_color=string]   [x_title=string]
[y_title=string]   [title=string]   [y_range=min,max]
[y_tics=float[,float,...]]   [x_scale=float]   [y_scale=float]
[icon=string]   [point_size=float]   [secondary_color=name]
[secondary_width=float[,float,...]]   [--help]  [--verbose]  [--quiet]
[--ui]

🚩 Flags 🚩

  • -x β€” scale only the X labels, not the values themselves. sneaky but valid ✨
  • -y β€” same energy but for Y: scale only the Y labels, not the values.
  • -s β€” draw points. dot dot dot πŸ”΅
  • -l β€” do not draw lines. just so we're clear on the vibe.
  • --help β€” prints the usage summary so you stop guessing πŸ’–
  • --verbose β€” verbose module output, aka it tells you everything.
  • --quiet β€” quiet module output, aka it tells you nothing πŸ™ˆ
  • --ui β€” forces the GUI dialog to launch. main character GUI energy πŸ‘‘

🌸 Parameters 🌸

  • x_file=string [required] β€” name of the data file for the X axis of the graph. can't skip this one, it's mandatory fr fr.
  • y_file=string[,string,...] [required] β€” name of the data file(s) for the Y axis of the graph. yes you can pass multiple, comma-separated, go off.
  • directory=string β€” path to the files. specifically, the path to the directory where all your input files are chilling.
  • y_color=string[,string,...] β€” color for the Y data. pick your palette bestie 🎨
  • color_table=style β€” name of the color table.

Options are: aspect, aspectcolr, bcyr, bgyr, blues, byg, byr, celsius, corine, curvature, differences, elevation, etopo2, evi, fahrenheit, forest_cover, gdd, grass, greens, grey, grey.eq, grey.log, grey1.0, grey255, gyr, haxby, inferno, kelvin, magma, ndvi, ndwi, nlcd, oranges, plasma, population, population_dens, precipitation, precipitation_daily, precipitation_monthly, rainbow, ramp, random, reds, roygbiv, rstcurv, ryb, ryg, sepia, slope, soilmoisture, srtm, srtm_percent, srtm_plus, terrain, viridis, water, wave

and here's the tea on each one πŸ‘‡

  • aspect: aspect oriented grey colors [range: map values]
  • aspectcolr: aspect oriented rainbow colors [range: 0 to 360]
  • bcyr: blue through cyan through yellow to red [range: map values]
  • bgyr: blue through green through yellow to red [range: map values]
  • blues: white to blue [range: map values]
  • byg: blue through yellow to green [range: map values]
  • byr: blue through yellow to red [range: map values]
  • celsius: blue to red for degree Celsius temperature [range: -80 to 80]
  • corine: EU Corine land cover colors [range: 111 to 995]
  • curvature: for terrain curvatures (from v.surf.rst and r.slope.aspect) [range: map values]
  • differences: differences oriented colors [range: map values]
  • elevation: maps relative ranges of raster values to elevation color ramp [range: map values]
  • etopo2: colors for ETOPO2 worldwide bathymetry/topography [range: -11000 to 8850]
  • evi: enhanced vegetative index colors [range: -1 to 1]
  • fahrenheit: blue to red for Fahrenheit temperature [range: -112 to 176]
  • forest_cover: percentage of forest cover [range: 0 to 100]
  • gdd: accumulated growing degree days [range: 0 to 6000]
  • grass: GRASS green (perceptually uniform) [range: map values]
  • greens: white to green [range: map values]
  • grey: grey scale [range: map values]
  • grey.eq: histogram-equalized grey scale [range: map values]
  • grey.log: histogram logarithmic transformed grey scale [range: map values]
  • grey1.0: grey scale for raster values between 0.0-1.0 [range: 0 to 1]
  • grey255: grey scale for raster values between 0-255 [range: 0 to 255]
  • gyr: green through yellow to red [range: map values]
  • haxby: relative colors for bathymetry or topography [range: map values]
  • inferno: perceptually uniform sequential color table inferno [range: map values]
  • kelvin: blue to red for temperature in Kelvin scale [range: 193.15 to 353.15]
  • magma: perceptually uniform sequential color table magma [range: map values]
  • ndvi: Normalized Difference Vegetation Index colors [range: -1 to 1]
  • ndwi: Normalized Difference Water Index colors [range: -200 to 200]
  • nlcd: US National Land Cover Dataset colors [range: 0 to 95]
  • oranges: white to orange [range: map values]
  • plasma: perceptually uniform sequential color table plasma [range: map values]
  • population: color table covering human population classification breaks [range: 0 to 2e+09]
  • population_dens: color table covering human population density classification breaks [range: 0 to 1e+09]
  • precipitation: precipitation color table (0..2000mm) [range: 0 to 7000]
  • precipitation_daily: precipitation color table (0..1000mm) [range: 0 to 10000]
  • precipitation_monthly: precipitation color table (0..1000mm) [range: 0 to 1000]
  • rainbow: rainbow color table [range: map values]
  • ramp: color ramp [range: map values]
  • random: random color table [range: map values]
  • reds: white to red [range: map values]
  • roygbiv: [range: map values]
  • rstcurv: terrain curvature (from r.resamp.rst) [range: map values]
  • ryb: red through yellow to blue [range: map values]
  • ryg: red through yellow to green [range: map values]
  • sepia: yellowish-brown through to white [range: map values]
  • slope: r.slope.aspect-type slope colors for raster values 0-90 [range: 0 to 90]
  • soilmoisture: soilmoisture color table (0.0-1.0) [range: 0 to 1]
  • srtm: color palette for Shuttle Radar Topography Mission elevation [range: -11000 to 8850]
  • srtm_percent: color palette for Shuttle Radar Topography Mission using relative elevation [range: map values]
  • srtm_plus: color palette for Shuttle Radar Topography Mission elevation (with seafloor colors) [range: -11000 to 8850]
  • terrain: global elevation color table covering -11000 to +8850m [range: -11000 to 8850]
  • viridis: perceptually uniform sequential color table viridis [range: map values]
  • water: water depth [range: map values]
  • wave: color wave [range: map values]
  • width=integer[,integer,...] β€” width of the lines. chunky lines? skinny lines? your call πŸ’…
  • title_color=string β€” color for the axis, tics, numbers, and title. Default: black
  • x_title=string β€” title for the X data. Default: (empty)
  • y_title=string β€” title for the Y data. Default: (empty)
  • title=string β€” title for the whole Graph. Default: (empty)
  • y_range=min,max β€” minimum and maximum value for the Y axis, written as (min,max).
  • y_tics=float[,float,...] β€” tic values for the Y axis.
  • x_scale=float β€” scale for X values.
  • y_scale=float β€” scale for Y values.
  • icon=string β€” symbol for point.

Options: basic/arrow, basic/arrow1, basic/arrow2, basic/arrow3, basic/box, basic/circle, basic/cross1, basic/cross2, basic/cross3, basic/diamond, basic/hexagon, basic/marker, basic/octagon, basic/pin, basic/pin_dot, basic/point, basic/pushpin, basic/star, basic/triangle, basic/x, demo/muchomurka, demo/smrk, extra/4pt_star, extra/adcp, extra/airport, extra/alpha_flag, extra/bridge, extra/dim_arrow, extra/dive_flag, extra/fiducial, extra/fish, extra/half-box, extra/half-circle, extra/offbox_ne, extra/offbox_nw, extra/offbox_se, extra/offbox_sw, extra/pentagon, extra/ping, extra/ring, extra/simple_zia, extra/target, geology/circle_cross, geology/half-arrow_left, geology/half-arrow_right, geology/strike_box, geology/strike_circle, geology/strike_cleavage, geology/strike_half-bowtie, geology/strike_line, geology/strike_parallel, geology/strike_triangle, legend/area, legend/area_curved, legend/line, legend/line_crooked, n_arrows/basic_compass, n_arrows/fancy_compass, n_arrows/n_arrow1a, n_arrows/n_arrow1b, n_arrows/n_arrow2, n_arrows/n_arrow3, n_arrows/n_arrow4, n_arrows/n_arrow5, n_arrows/n_arrow6, n_arrows/n_arrow7a, n_arrows/n_arrow7b, n_arrows/n_arrow8a, n_arrows/n_arrow8b, n_arrows/n_arrow9

Default: basic/circle

  • point_size=float β€” point size. Default: 5
  • secondary_color=name β€” Color. specifically, the color for the point symbol edge color. Default: black
  • secondary_width=float[,float,...] β€” width of the point symbol lines. Default: 0.1

✨ DESCRIPTION ✨

okay so d.linegraph is literally the module that draws simple x,y line graphs (aka plots) based on numerical data living in separate files. it's giving "i have numbers and i want a cute little line to connect them" energy πŸ’…


πŸ“Š Data format πŸ“Š

so the X and Y data files for your graph are basically just a column of numbers in each file, one input number per line. the program expects that each X value will have a corresponding Y value, so the number of lines in each data input file should be the same β€” no cap, they gotta match up fr fr.

essentially the X data becomes the X axis reference to which the Y data is plotted as a line. so the X data should be a monotonically increasing progression of numbers, like:

  • "1,2,3,..."
  • "0, 10, 100, 1000,..."
  • "...-5,-1,0,1,5..."

if you use multiple Y data files, the Y axis scale will be based on the range of minimum and maximum values from all Y files, and then all Y data given will be graphed according to that Y scale. so if you use multiple Y data inputs with dissimilar units, the graph produced comparing the two will be deceptive 😭 β€” like bestie don't do that, it'll lie to you.


πŸ“ File inputs πŸ“

if the directory option is provided, the paths to files can (and should) be only relative paths to these files. while this is not recommended for scripting, it can be advantageous when typing the paths manually. for example when all files are stored in the directory /home/john/data, the user can provide the following in the command line:

d.linegraph directory=/home/john/data x_file=x.txt y_file=y1.txt,y2.txt

see? lowkey convenient when you're just typing it out yourself 🫢


🎨 Managing colors 🎨

the user can specify the y_color option, the color_table option, or just leave the defaults to influence the color of the plotted lines.

colors specified by the y_color option are used for drawing the lines in the graph. if multiple Y data files are used, an equal number of colors may be used to control the colors of the lines. colors will be assigned to Y data in respect to the sequence of instantiation on the command line. it can be one of GRASS named colors or the RGB values from 0-255 separated by colons (RRR:GGG:BBB).

alternatively, the user can use the color_table option to specify one of the GRASS predefined color tables.

by default, a series of colors will be chosen by the module if none are provided upon invocation. the order of default colors is red, green, violet, blue, orange, gray, brown, magenta, white, and indigo. the user is advised not to rely on the order of default colors but to either use the y_color or the color_table option to obtain predictable and reproducible results. periodt πŸ’…

the color to be used for titles, axis lines, tics, and scale numbers is determined by the title_color option. the user can provide one of the GRASS named colors (such as gray, white, or black) or use the GRASS colon-separated format for RGB (RRR:GGG:BBB).


✍️ Titles, labels, and tics ✍️

the title option specifies the text for the title of the graph. it will be centered over the top of graph. iconic placement honestly.

the x_title option is a text to describe data for X axis. it will be centered beneath the graph. default is no text unless there is a need for a unit descriptor determined by the d.linegraph module, then string such as "in hundreds" is generated. so it'll just make one up for you if it has to 🧚

the y_title option is a text to describe data for Y axis. it will be centered beneath the X data description. similarly to the x_title option, default is no text unless there is a need for an auto-generated description. in the case of graphs with multiple lines (multiple inputs for Y axis), user may wish to use more specific text placement using the d.text or v.label programs. iykyk πŸ’œ


πŸ“ NOTES πŸ“

for historical reasons, the d.linegraph module accepts titles of more than one word where the underscore character ("_") is used to represent spaces (" "). for example "Census_data_1990" would be printed over the graph as "Census data 1990". the use of underscores is not necessary to use as long as the parameter is quoted in the command line. in general, use of underscores is not recommended and there is no need to use it at all in the GUI or when using d.linegraph in Python scripts. okay so that's a whole historical vibe, we don't need to do that anymore bestie 😭

the way the program locates and labels tic marks is less than perfect:

  1. although distances between Y tics are proportional to the value, they are not proportional on the X axis;
  2. decimal values between -1 and 1 can be printed on the X axis, but not on Y. (with respect to the later, the input for Y values can all be multiplied by a factor of 10 before graphing).

depending on the user's needs, it might be easier or more appropriate to use a 3rd party tool such as xgraph, gnuplot, Matplotlib in Python, or R instead of d.linegraph. for a more general solution for plotting in GRASS, the user is advised to use the d.graph module. no shade to d.linegraph but sometimes you just gotta use the right tool for the job πŸ’€


🌈 EXAMPLE 🌈

the following can be executed in Bash to create the input data for this example. the user can just create these files in a text editor, save them and specify path to them.

cat > x.txt <<EOF
1
3
4
6
9
EOF
cat > y1.txt <<EOF
50
58
65
34
27
EOF
cat > y2.txt <<EOF
10
20
35
50
45
EOF

the next command sequence creates a file plot.png in the current directory which is the drawing made by d.linegraph.

d.mon start=cairo output=plot.png width=400 height=400
d.linegraph x_file=x.txt y_file=y1.txt,y2.txt
d.mon stop=cairo

and that's it, you got yourself a whole graph bestie, ate and left no crumbs πŸŽ€βœ¨


πŸ‘€ SEE ALSO πŸ‘€

  • d.frame
  • d.text
  • v.label
  • d.graph
  • d.histogram

πŸ‘‘ AUTHOR πŸ‘‘

Chris Rewerts, Agricultural Engineering, Purdue University


πŸ’» SOURCE CODE πŸ’»

Available at: d.linegraph source code (history)

Latest change: Friday Aug 08 09:39:19 2025 in commit:

ed72c71d8580e872cd6fd345c84a15c324764465

Main index | Display index | Topics index | Keywords index | Graphical index | Full index

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual


that's the whole page bestie!! this came from the GRASS 8.5.0 reference manual, the d.linegraph(1grass) page, and the last change was Friday Aug 08 09:39:19 2025. slay, go make some graphs πŸ’œβœ¨

πŸ“¦ where this page comes from