Plot multiple Surfaces to Axes in GUI?
Show older comments
Hello.
I am trying to plot 6 surfaces that create a cube to an axes within a GUI but cannot figure out how.
Any advice on how to go about doing this?
Attached is a photo of the cube plot in a figure.
Below is the code I use for producing the figure. I just need that figure to go into the GUI axes.
Thanks,
Nicholas
hold on
sA = surf(mg1, mg2, z1, fMat{1}', 'FaceColor', 'texturemap','LineWidth',3);
sB = surf(xn1, mg2, mg1,fMat{2}', 'FaceColor', 'texturemap','LineWidth',3);
sC = surf(mg1, mg2, zn1,fliplr(fMat{3}'), 'FaceColor', 'texturemap','LineWidth',3);
sD = surf(x1, mg1, mg2, flipud(fMat{4}), 'FaceColor', 'texturemap','LineWidth',3);
sE = surf(mg1, yn1, mg2,flipud(fMat{5}), 'FaceColor', 'texturemap','LineWidth',3);
sF = surf(mg1, y1, mg2, fliplr(flipud(fMat{6})), 'FaceColor', 'texturemap','LineWidth',3);
Answers (1)
Adam
on 3 May 2017
doc surf
There is a syntax for surf as:
surf( ax,... )
which allows you to pass in an axes handle as the first argument, then everything else after it exactly as you have it now.
Also
hold( ax, 'on' )
will hold this axes on. Just pass in the handle to the axes in your GUI.
You should get used to always using this syntax with an explicit axes handle.
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!