MATLAB Answers

two plots in same GUI

Asked by Lalit Patil on 25 Dec 2012
 a = [2 3 7];
 a = [6 3 4];

I have to plot this both 3D plots in different figures in same GUI.

so, below each plot3 commant what line i have to write to do this..

I understand that something like




may be, but give me an exact command.




No products are associated with this question.

1 Answer

Answer by Walter Roberson
on 25 Dec 2012
 Accepted answer


Walter Roberson
on 25 Dec 2012

In MATLAB, "figure" and "window" are the same thing: "figure" is MATLAB's term for windows.

You can have multiple axes in the same window, though, and you can have multiple lines on any axes.

If you want two plots on the same axes, then you can use

 a = [2 3 7];
 hold on
 a = [6 3 4];

or better,

a = [2 3 7];
b = [6 3 4];
plot3( a(1), a(2), a(3), 'r.', b(1), b(2), b(3), 'r.')
Lalit Patil on 25 Dec 2012

Yes, what you given works correctly for two plots on same axes.. But, i mean to ask is on same GUI means on two different axes.. Which i think requires use of handle..

Walter Roberson
on 25 Dec 2012

Then just follow the instructions from the link I gave, to parent the plot3() against the appropriate axes.

a = [2 3 7];
plot3(FirstAxesHandle, a(1), a(2), a(3), 'r.')


plot3(a(1), a(2), a(3), 'r.', 'Parent', FirstAxesHandle)

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!