Step
|
Typical Code
|
- Prepare your data
|
Z = peaks(20);
|
- Select window and position plot region within window
|
figure(1)
subplot(2,1,2)
|
- Call 3-D graphing function
|
h = surf(Z);
|
- Set colormap and shading algorithm
|
colormap hot
shading interp
set(h,'EdgeColor','k')
|
- Add lighting
|
light('Position',[-2,2,20])
lighting phong
material([0.4,0.6,0.5,30])
set(h,'FaceColor',[0.7 0.7 0],...
'BackFaceLighting','lit')
|
- Set viewpoint
|
view([30,25])
set(gca,'CameraViewAngleMode','Manual')
|
- Set axis limits and tick marks
|
axis([5 15 5 15 -8 8])
set(gca,'ZTickLabel','Negative||Positive')
|
- Set aspect ratio
|
set(gca,'PlotBoxAspectRatio',[2.5 2.5 1])
|
- Annotate the graph with axis labels, legend, and text
|
xlabel('X Axis')
ylabel('Y Axis')
zlabel('Function Value')
title('Peaks')
|
- Print graph
|
set(gcf,'PaperPositionMode','auto')
print -dps2
|