Skip to content

d.barscale

Displays a barscale on the graphics monitor.

d.barscale [-ftn] [style=string] [at=x,y] [length=integer] [units=string] [label=string] [segment=integer] [color=name] [bgcolor=name] [text_position=string] [width_scale=float] [font=string] [fontsize=float] [path=name] [charset=string] [--verbose] [--quiet] [--qq] [--ui]

Example:

d.barscale

grass.script.run_command("d.barscale", style="classic", at="0.0,10.0", length=0, units=None, label=None, segment=10, color="black", bgcolor="white", text_position="right", width_scale=1, font=None, fontsize=12, path=None, charset=None, flags=None, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("d.barscale")

Parameters

style=string
    Type of barscale to draw
    Allowed values: classic, line, solid, hollow, full_checker, part_checker, mixed_checker, tail_checker, up_ticks, down_ticks, both_ticks, arrow_ends
    Default: classic
        classic     classic: Classic style
        line     line: Line style
        solid     solid: Solid style
        hollow     hollow: Hollow style
        full_checker     full_checker: Full checker style
        part_checker     part_checker: Part checker style
        mixed_checker     mixed_checker: Mixed checker style
        tail_checker     tail_checker: Tail checker style
        up_ticks     up_ticks: Up ticks style
        down_ticks     down_ticks: Down ticks style
        both_ticks     both_ticks: Both ticks style
        arrow_ends     arrow_ends: Arrow ends style
at=x,y
    Screen coordinates of the rectangle's top-left corner
    (0,0) is lower-left of the display frame
    Allowed values: 0-100
    Default: 0.0,10.0
length=integer
    Length of barscale in map units
    Allowed values: 0-
    Default: 0
units=string
    Barscale units to display
    Allowed values: meters, kilometers, feet, miles
label=string
    Custom label of unit
segment=integer
    Number of segments
    Allowed values: 1-100
    Default: 10
color=name
    Bar scale and text color
    Either a standard color name or R:G:B triplet
    Default: black
bgcolor=name
    Background color (drawn behind the bar)
    Either a standard color name, R:G:B triplet, or "none"
    Default: white
text_position=string
    Text position
    Allowed values: under, over, left, right
    Default: right
width_scale=float
    Scale factor to change bar width
    Allowed values: 0.5-100
    Default: 1
font=string
    Font name
fontsize=float
    Font size
    Allowed values: 1-360
    Default: 12
path=name
    Path to font file
charset=string
    Text encoding (only applicable to TrueType fonts)
-f
    Use feet/miles instead of meters
-t
    Draw the scale bar without text
-n
    Display north-arrow symbol.
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

style : str, optional
    Type of barscale to draw
    Used as: input, barscale
    Allowed values: classic, line, solid, hollow, full_checker, part_checker, mixed_checker, tail_checker, up_ticks, down_ticks, both_ticks, arrow_ends
        classic     classic: Classic style
        line     line: Line style
        solid     solid: Solid style
        hollow     hollow: Hollow style
        full_checker     full_checker: Full checker style
        part_checker     part_checker: Part checker style
        mixed_checker     mixed_checker: Mixed checker style
        tail_checker     tail_checker: Tail checker style
        up_ticks     up_ticks: Up ticks style
        down_ticks     down_ticks: Down ticks style
        both_ticks     both_ticks: Both ticks style
        arrow_ends     arrow_ends: Arrow ends style
    Default: classic
at : tuple[float, float] | list[float] | str, optional
    Screen coordinates of the rectangle's top-left corner
    (0,0) is lower-left of the display frame
    Used as: x,y
    Allowed values: 0-100
    Default: 0.0,10.0
length : int, optional
    Length of barscale in map units
    Used as: integer
    Allowed values: 0-
    Default: 0
units : str, optional
    Barscale units to display
    Allowed values: meters, kilometers, feet, miles
label : str, optional
    Custom label of unit
segment : int, optional
    Number of segments
    Allowed values: 1-100
    Default: 10
color : str, optional
    Bar scale and text color
    Either a standard color name or R:G:B triplet
    Used as: input, color, name
    Default: black
bgcolor : str, optional
    Background color (drawn behind the bar)
    Either a standard color name, R:G:B triplet, or "none"
    Used as: input, color, name
    Default: white
text_position : str, optional
    Text position
    Allowed values: under, over, left, right
    Default: right
width_scale : float, optional
    Scale factor to change bar width
    Allowed values: 0.5-100
    Default: 1
font : str, optional
    Font name
fontsize : float, optional
    Font size
    Allowed values: 1-360
    Default: 12
path : str, optional
    Path to font file
    Used as: input, file, name
charset : str, optional
    Text encoding (only applicable to TrueType fonts)
flags : str, optional
    Allowed values: f, t, n
    f
        Use feet/miles instead of meters
    t
        Draw the scale bar without text
    n
        Display north-arrow symbol.
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

d.barscale displays a barscale on the graphics monitor at the given screen coordinates. If no coordinates are given it will draw the barscale in the bottom left of the display.

The barscale can drawn in a number of styles (see style parameter for their previews).

NOTE

d.barscale will not work with Lat/Lon coordinate reference system as the horizontal scale distance changes with latitude. Try d.grid instead.

SEE ALSO

d.graph, d.grid, d.legend, d.northarrow, g.region

AUTHORS

Unknown, from USACE/CERL.
Major rewrite for GRASS 7 by Hamish Bowman

SOURCE CODE

Available at: d.barscale source code (history)
Latest change: Thursday Mar 27 08:35:39 2025 in commit dc19150