28.12.2012 Views

Figure Properties - SERC

Figure Properties - SERC

Figure Properties - SERC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The property linking code is in step 3.<br />

1 Define the data using the flow M-file and specify property values for the<br />

isosurface (which is a patch object).<br />

function linkprop_example<br />

[x y z v] = flow;<br />

isoval = [-3 -1 0 1];<br />

props.FaceColor = [0 0 .5];<br />

props.EdgeColor = 'none';<br />

props.AmbientStrength = 1;<br />

props.FaceLighting = 'gouraud';<br />

linkprop<br />

2 Create four subplot axes and add an isosurface graph to each one. Add a title<br />

and set viewing and lighting parameters using a local function (set_view).<br />

(subplot, patch, isosurface, title, num2str)<br />

for k = 1:4<br />

h(k) = subplot(2,2,k);<br />

patch(isosurface(x,y,z,v,isoval(k)),props)<br />

title(h(k),['Isovalue = ',num2str(k)])<br />

set_view(h(k))<br />

end<br />

3 Link the CameraPosition and CameraTarget properties of all subplot axes.<br />

Since this example function will have completed execution when the user is<br />

rotating the subplots, the link object is stored in the first subplot axes<br />

application data. See setappdata for more information on using application<br />

data.<br />

hlink = linkprop(h,{'CameraPosition','CameraUpVector'});<br />

key = 'graphics_linkprop';<br />

% Store link object on first subplot axes<br />

setappdata(h(1),key,hlink);<br />

4 The following local function contains viewing and lighting commands issued<br />

on each axes. It is called with the creation of each subplot (view, axis,<br />

camlight).<br />

function set_view(ax)<br />

% Set the view and add lighting<br />

view(ax,3); axis(ax,'tight','equal')<br />

camlight left; camlight right<br />

2-1351

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!