This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Resize axes for equivalent scale




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.


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;

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


% 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
hidem([halaska hhawaii])


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.


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

See Also

Introduced before R2006a

Was this topic helpful?