axesscale

Resize axes for equivalent scale

Syntax

axesscale
axesscale(hbase)
axesscale(hbase,hother)

Description

axesscale resizes all axes in the current figure to have the same scale as the current axes (gca). In this context, scale means the relationship between axes x- and y-coordinates and figure and paper coordinates. When axesscale is used, a unit of length in x and y is printed and displayed at the same size in all the affected axes. The XLimMode and YLimMode of the axes are set to 'manual' to prevent autoscaling from changing the scale.

axesscale(hbase) uses the axes hbase as the reference axes, and rescales the other axes in the current figure.

axesscale(hbase,hother) uses the axes hbase as the base axes, and rescales only the axes in hother.

Examples

Display the conterminous United States, Alaska, and Hawaii in separate axes in the same figure, with a common scale.

% Read state names and coordinates, extract Alaska and Hawaii
states = shaperead('usastatehi', 'UseGeoCoords', true);
statenames = {states.Name};
alaska = states(strcmp('Alaska', statenames));
hawaii = states(strcmp('Hawaii', statenames));

% Create a figure for the conterminous states
f1 = figure; hconus = usamap('conus'); tightmap
geoshow(states, 'FaceColor', [0.5 1 0.5]);
framem off; gridm off; mlabel off; plabel off
load conus gtlakelat gtlakelon
geoshow(gtlakelat, gtlakelon,...
  'DisplayType', 'polygon', 'FaceColor', 'cyan')
gridm off;

% Working figure for additional calls to usamap
f2 = figure('Visible','off');

halaska = axes; usamap('alaska'); tightmap;
geoshow(alaska, 'FaceColor', [0.5 1 0.5]);
gridm off;
framem off; mlabel off; plabel off; gridm off;
set(halaska,'Parent',f1)

hhawaii = axes; usamap('hawaii'); tightmap; 
geoshow(hawaii, 'FaceColor', [0.5 1 0.5]);
gridm off;
framem off; mlabel off; plabel off; gridm off;
set(hhawaii,'Parent',f1)

close(f2)

% Arrange the axes as desired
set(hconus,'Position',[0.1 0.25 0.85 0.6])
set(halaska,'Position',[0.019531 -0.020833 0.2 0.2])
set(hhawaii,'Position',[0.5 0 .2 .2])

% Resize alaska and hawaii axes
axesscale(hconus)
hidem([halaska hhawaii])

Limitations

The equivalence of scales holds only as long as no commands are issued that can change the scale of one of the axes. For example, changing the units of the ellipsoid or the scale factor in one of the axes would change the scale.

More About

expand all

Tips

To ensure the same map scale between axes, use the same ellipsoid and scale factors.

See Also

Was this topic helpful?