![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175425/image.jpeg)
Obtain two different types of plots in same figure
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
KRUNAL
am 19 Aug. 2014
Beantwortet: KRUNAL
am 21 Aug. 2014
I have one surface plot(3D) and one 2D plot. How can I obtain them on the same figure ?
Consider we have surface plot of peaks and 2D plot of sin. Can we obtain a figure containing both of them one below the other like subplot of 2 line plots ?
0 Kommentare
Akzeptierte Antwort
Andrew Reibold
am 19 Aug. 2014
Bearbeitet: Andrew Reibold
am 19 Aug. 2014
You can use subplots like normal (yay!) I just tried it with a surface plot on the left and a line plot on the right. Here is an example below with a picture of the figure I got too.
(Both of those show up on the same figure)
%Some things to plot
a = [1:3];
b = [1:3];
c = [1 2 3;3 4 3; 3 2 1];
t = 1:.01:10;
y = sin(t);
%Plotting in one figure window
figure
subplot(1,2,1)
surf(a,b,c)
subplot(1,2,2)
plot(t,y)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175425/image.jpeg)
5 Kommentare
Andrew Reibold
am 21 Aug. 2014
I'm sorry I neglected to read that you wanted one right below the other rather then side-by-side.
Do you know how to change that? You use subplot(2,1,1) and subplot(2,1,2) instead of subplot(1,2,1) and subplot(1,2,2)
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Scatter Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!