Get default scale bar parameters based on the current plot (i.e.
The algorithm attempts to detect the best equally divisable distance to use for the
scale bar, and returns a
list object with attributes that allow any type of
scale bar to be drawn. The only way to manipulate the values chosen by the algorithm
is to change the
widthhint argument. For generic XY plots, pass
The unit which the current plot is plotted in, one of
The projection of the current plot. If extents are valid lat/lons, the projection is assumed to be lat/lon (EPSG:4326), or Spherical Mercator otherwise (EPSG:3857). This is done to work seamlessly with OpenStreetMap packages.
The fraction of the plottable width which the scale bar should (mostly) occupy.
One of "metric" or "imperial"
The plot extents
list of parameters:
$widthu (width of the scalebar in human
$unit (the human readable unit);
$majordivu (the size
of the divisions in human readable units);
$majordivs (the number of divisions);
$widthplotunit (width of the scalebar in plotting units);
(the width of divisions in plotting units);
$labeltext (label text); and
the user extents (
par('usr')) that were used to calculate the parameters.
1 2 3 4 5 6 7
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.