Code covered by the BSD License  

Highlights from
scalebar for maps

Be the first to rate this file! 13 Downloads (last 30 days) File Size: 34.9 KB File ID: #43500 Version: 1.1
image thumbnail

scalebar for maps


Chad Greene (view profile)


16 Sep 2013 (Updated )

A simpler alternative to the built-in Mapping Toolbox function scaleruler.

| Watch this File

File Information

The scaleruler function in the Mapping Toolbox is powerful, but it can be a bit clunky and difficult to work with. This scalebar function is a simpler, less powerful alternative. Simply type "scalebar" for a 100 km scale bar in the lower left corner of your map.

h = scalebar(...)

scalebar places a 100 km graphical reference scale at the lower left-hand corner of a map.

scalebar('Length',LengthInKilometers) specifies the length of the scalebar. Default length is 100 km. Talk about a scalar value, am I right?

scalebar('Location','LocationOnMap') specifies location of the scalebar on the map. Location can be

    'southwest' (lower left) {default}
    'northwest' (upper left)
    'northeast' (upper right)
    'southeast' (lower right)

scalebar('Orientation','VerticalOrHorizontal') specifies a 'vertical' or 'horizontal' scalebar. Default value is 'horizontal'.

scalebar('TextProperty',TextValue) specifies properties of text.

scalebar('LineProperty',LineValue) specifies properties of the reference scale line.

h = scalebar(...) returns a handle for the scalebar.

Disclaimer: This scale bar is intended to show approximate distances. The scale is inexact, and errors increase with the size of any map. In fact, it's probably poor practice to put any scale reference on a map of an area as large as Texas. Nonetheless, this scalebar function will display a ballpark size reference.


This file inspired Antarctic Mapping Tools, Circlem, Gdistm, and Landsat.

Required Products Mapping Toolbox
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
20 Aug 2014 1.1

Inclusion of example file.

Contact us