source: MML/trunk/machine/SOLEIL/common/toolbox/GUILayout/layoutHelp/Examples/axesexample.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.5 KB
Line 
1%% Axes inside layouts
2% This example demonstrates how axes are affected by being placed into
3% layouts. The layouts take into account the "ActivePositionProperty" in
4% order to determine whether to set the "Position" or "OuterPosition"
5% (default) property of the axes.
6
7%% Open the window
8% Open a new figure window and remove the toolbar and menus
9window = figure( 'Name', 'Axes inside layouts', ...
10    'MenuBar', 'none', ...
11    'Toolbar', 'none', ...
12    'NumberTitle', 'off' );
13
14%% Create the layout
15% The layout involves two axes side by side. This is done using a
16% flexible horizontal box. The left-hand axes is left with the
17% ActivePositionProperty set to "OuterPosition", but the right-hand axes is
18% switched to use "Position"
19hbox = uiextras.HBoxFlex('Parent', window, 'Spacing', 3);
20axes1 = axes( 'Parent', hbox, ...
21    'ActivePositionProperty', 'OuterPosition' );
22axes2 = axes( 'Parent', hbox, ...
23    'ActivePositionProperty', 'Position' );
24set( hbox, 'Sizes', [-2 -1] );
25
26%% Fill the axes
27% Using "OuterPosition" (left-hand axes) is the normal mode and looks good
28% for virtually any plot type. Using "Position" is only really useful for
29% 2D plots with the axes turned off, such as images
30x = membrane( 1, 15 );
31surf( axes1, x );
32lighting( axes1, 'gouraud' );
33shading( axes1, 'interp' );
34l = light( 'Parent', axes1 );
35camlight( l, 'head' );
36axis( axes1, 'tight' );
37
38imagesc( x, 'Parent', axes2 );
39set( axes2, 'xticklabel', [], 'yticklabel', [] );
Note: See TracBrowser for help on using the repository browser.