d.legend.vect(1)
π d.legend.vect π
okay bestie, so this is the manual page for d.legend.vect β that's the GRASS GIS User's Manual version, and she's a display module that draws you a cute little vector legend inside whatever graphics frame you've got going. π₯
KEYWORDS: display, cartography, vector, legend
β¨ SYNOPSIS β¨
d.legend.vect
d.legend.vect --help
d.legend.vect [-b] [at=left,top] [columns=integer] [title=string]
[symbol_size=integer] [border_color=name] [bgcolor=name]
[border_width=integer] [font=string] [fontsize=float]
[title_font=string] [title_fontsize=float] [sub_font=string]
[sub_fontsize=float] [fontcolor=name] [separator=character]
[input=name] [output=name] [--overwrite] [--help] [--verbose]
[--quiet] [--ui]
π© Flags
-bβ draw the legend background. yes she can have a lil backdrop, she's that girl π--overwriteβ lets output files overwrite existing files, no questions asked--helpβ prints the usage summary--verboseβ verbose module output, she's chatty--quietβ quiet module output, she's mysterious--uiβ force launching the GUI dialog
ποΈ Parameters
at=left,topβ where on the screen the legend gets drawn (percentage, and[0,0]is the lower left) Options:0-100Default:10,40columns=integerβ how many legend columns you want Default:1title=stringβ the legend titlesymbol_size=integerβ symbol size Default:20border_color=nameβ border color Either a standard color name, R:G:B triplet, or"none"Default:blackbgcolor=nameβ background color Either a standard color name, R:G:B triplet, or"none"Default:whiteborder_width=integerβ background border width Default:2font=stringβ font namefontsize=floatβ font size Default:12Options:1-360title_font=stringβ title font nametitle_fontsize=floatβ title font size Default:18Options:1-360sub_font=stringβ subtitle font namesub_fontsize=floatβ subtitle font size Default:14Options:1-360fontcolor=nameβ font color Either a standard color name or R:G:B triplet Default:blackseparator=characterβ field separator for the input file Special characters: pipe, comma, space, tab, newline Default: pipeinput=nameβ input legend file Path to legend fileoutput=nameβ output csv file Path to output file or-for standard output
πΈ DESCRIPTION πΈ
d.legend.vect draws the vector legend of whatever vector maps are currently being displayed. she just shows up and does her thing π
The parameter at defines the screen position of the upper-left corner of the legend. The parameter columns defines the number of legend columns. You can specify a title for the legend with the parameter title. The font of the title can be changed with title_font and title_fontsize. The flag -b is used to draw the background in a specified color (bgcolor), plus the border color and border width (border_color and border_width). The parameter symbol_size defines the size of line and area symbols. The size of point symbols is based on the symbology currently set for the vector maps via d.vect or d.vect.thematic.
The module d.vect.legend supports subtitles (see the Notes section, bestie). Their font and font size can be set using the parameters sub_font and sub_fontsize.
ποΈ Changing legend symbols and labels
Symbols for vector areas and lines, and labels for individual vector labels, can be changed in the symbology setting of each vector map in d.vect or d.vect.thematic (it's in the Legend tab, iykyk). Use the parameters icon_area and icon_line to pick from the available symbols. And by using the parameter legend_label of the d.vect module, you can change the default label, which is just the map name.
π Modifying the order of legend entries and omitting certain vector maps from legend
The modules d.vect and d.vect.thematic have a flag -s which removes that particular vector or thematic vector from the vector legend. bye bestie π
The order of entries is defined by the order in the Layer Manager (if you're using the GRASS GIS GUI). If that's not what you want, you can export the legend file into a text file using the parameter output, change the order of entries (see the Notes section for the format description, she explains everything), and then upload the modified file with the parameter input. The parameter output defines the path to the file where the internal legend file will be saved, and input defines the input file which the vector legend will be based on (input file must have the correct format, no cap).
π NOTES π
The module d.legend.vect draws the vector legend based on the legend file defined in the shell environment variable GRASS_LEGEND_FILE. This file is automatically created and updated whenever the d.vect command is used. You can create a custom legend file and then use export GRASS_LEGEND_FILE=path/to/file in your shell. The GRASS GUI and MONITORS create the legend file automatically. By default the legend file is stored in the grassdata/project/mapset/.tmp/user directory (and in the case of d.mon, deeper in the /monitor_name directory).
The legend file has this format:
label|symbol_name|size|color_type|feature_color|fill_color|line_width|geometry_type|feature_count
Color type can be 'lf' or 'ps'. Based on the color type, the color columns are interpreted as line color and fill colors (lf), or primary and secondary colors (ps). The module d.vect always uses 'lf' and d.vect.thematic uses 'ps'.
Here's an example of a legend file with subtitles, look at her go π¦:
Infrastructure||||||||
major roads|legend/line|5|lf|black|200:200:200|2|line|355
bridges|extra/bridge|15|lf|black|black|1|point|10938
Hydrology||||||||
streams|legend/line_crooked|5|lf|30:144:255|200:200:200|3|line|8554
water bodies|legend/area_curved|5|lf|none|30:144:255|1|area|27764
π EXAMPLES π
Open a cairo monitor to render to a file:
g.region vector=nc_state
d.mon cairo
d.vect map=nc_state color=26:26:26 fill_color=229:229:229 width=2 legend_label="state boundaries"
d.vect map=urbanarea color=none fill_color=127:127:127 width=1 legend_label="urban areas"
d.vect map=railroads color=red width=1
d.vect map=hospitals color=77:77:77 fill_color=0:187:0 width=1 icon=basic/cross3 size=10
d.legend.vect -b at=2,40 title="Hospitals in North Carolina" symbol_size=26 fontsize=16 title_fontsize=20
π SEE ALSO π
d.vect, d.vect.thematic, d.legend
Check also the Python module from AddOns: d.vect.thematic2
π AUTHORS π
Adam Laza, during GSoC 2016 Mentors: Anna Petrasova, Vaclav Petras, Martin Landa
πΎ SOURCE CODE πΎ
Available at: d.legend.vect source code (history)
Accessed: Saturday Jan 17 05:40:35 2026
Main index | Display index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
and that's the whole page, bestie!! π«Ά this was GRASS 8.4.2, page d.legend.vect(1), accessed Saturday Jan 17 05:40:35 2026 β go draw yourself a gorgeous legend, you ate π
β¨
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms