Just as the properties of the underlying standard axes can be accessed and manipulated using the MATLAB® functions get
and set
, map axes properties can also be accessed and manipulated using the functions getm
and setm
.
Use the axesm
function only to create a map axes object. Use the setm
function to modify an existing map axes.
Create a map axes object containing no map data. Note that you specify MapProjection
ID values in lowercase.
axesm('MapProjection','miller','Frame','on')
At this point you can begin to customize the map. For example, you might decide to make the frame lines bordering the map thicker. First, you need to identify the current line width of the frame, which you do by querying the current axes, identified as gca
.
getm(gca,'FLineWidth')
ans = 2
Now reset the line width to four points. The default fontunits
value for axes is points
. You can set fontunits
to be points
, normalized
, inches
, centimeters
, or pixels
.
setm(gca,'FLineWidth',4)
You can set any number of properties simultaneously with setm
. Continue by reducing the line width, changing the projection to equidistant cylindrical, and verify the changes.
setm(gca,'FLineWidth',3,'Grid','on','MapProjection','robinson')
getm(gca,'FLineWidth')
ans = 3
getm(gca,'MapProjection')
ans = 'robinson'
Inspect the entire set of map axes properties at their current settings. Note that the list of properties includes both those particular to map axes and general ones that apply to all MATLAB® axes.
getm(gca)
ans = struct with fields:
mapprojection: 'robinson'
zone: []
angleunits: 'degrees'
aspect: 'normal'
falsenorthing: 0
falseeasting: 0
fixedorient: []
geoid: [1 0]
maplatlimit: [-90 90]
maplonlimit: [-180 180]
mapparallels: 38
nparallels: 0
origin: [0 0 0]
scalefactor: 1
trimlat: [-90 90]
trimlon: [-180 180]
frame: 'on'
ffill: 100
fedgecolor: [0.1500 0.1500 0.1500]
ffacecolor: 'none'
flatlimit: [-90 90]
flinewidth: 3
flonlimit: [-180 180]
grid: 'on'
galtitude: Inf
gcolor: [0.1500 0.1500 0.1500]
glinestyle: ':'
glinewidth: 0.5000
mlineexception: []
mlinefill: 100
mlinelimit: []
mlinelocation: 30
mlinevisible: 'on'
plineexception: []
plinefill: 100
plinelimit: []
plinelocation: 15
plinevisible: 'on'
fontangle: 'normal'
fontcolor: [0.1500 0.1500 0.1500]
fontname: 'Helvetica'
fontsize: 10
fontunits: 'points'
fontweight: 'normal'
labelformat: 'compass'
labelrotation: 'off'
labelunits: 'degrees'
meridianlabel: 'off'
mlabellocation: 30
mlabelparallel: 90
mlabelround: 0
parallellabel: 'off'
plabellocation: 15
plabelmeridian: -180
plabelround: 0
Similarly, use the setm
function alone to display the set of properties, their enumerated values, and defaults.
setm(gca)
AngleUnits [ {degrees} | radians ] Aspect [ {normal} | transverse ] FalseEasting FalseNorthing FixedOrient FixedOrient is a read-only property Geoid MapLatLimit MapLonLimit MapParallels MapProjection NParallels NParallels is a read-only property Origin ScaleFactor TrimLat TrimLat is a read-only property TrimLon TrimLon is a read-only property Zone Frame [ on | {off} ] FEdgeColor FFaceColor FFill FLatLimit FLineWidth FLonLimit Grid [ on | {off} ] GAltitude GColor GLineStyle [ - | -- | -. | {:} ] GLineWidth MLineException MLineFill MLineLimit MLineLocation MLineVisible [ {on} | off ] PLineException PLineFill PLineLimit PLineLocation PLineVisible [ {on} | off ] FontAngle [ {normal} | italic | oblique ] FontColor FontName FontSize FontUnits [ inches | centimeters | normalized | {points} | pixels ] FontWeight [ {normal} | bold ] LabelFormat [ {compass} | signed | none ] LabelRotation [ on | {off} ] LabelUnits [ {degrees} | radians ] MeridianLabel [ on | {off} ] MLabelLocation MLabelParallel MLabelRound ParallelLabel [ on | {off} ] PLabelLocation PLabelMeridian PLabelRound
Many, but not all, property choices and defaults can also be displayed individually.
setm(gca,'FontUnits')
FontUnits [ inches | centimeters | normalized | {points} | pixels ]
setm(gca,'MapProjection')
An axes's "MapProjection" property does not have a fixed set of property values.
setm(gca,'Frame')
Frame [ on | {off} ]
setm(gca,'FixedOrient')
FixedOrient FixedOrient is a read-only property
In the same way, getm
displays the current value of any axes property.
getm(gca,'FontUnits')
ans = 'points'
getm(gca,'MapProjection')
ans = 'robinson'
getm(gca,'Frame')
ans = 'on'
getm(gca,'FixedOrient')
ans = []
For a complete listing and descriptions of map axes properties, see the reference page for axesm
. To identify which properties apply to a given map projection, see the reference page for that projection.