Obtain two different types of plots in same figure

조회 수: 4 (최근 30일)
KRUNAL
KRUNAL 2014년 8월 19일
답변: KRUNAL 2014년 8월 21일
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 ?

채택된 답변

Andrew Reibold
Andrew Reibold 2014년 8월 19일
편집: Andrew Reibold 2014년 8월 19일
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)
  댓글 수: 5
Andrew Reibold
Andrew Reibold 2014년 8월 21일
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)
KRUNAL
KRUNAL 2014년 8월 21일
Yes, I know and I did that way only :)
Anyways thank you for your concern and making me as well others who are following this question to see the correction required.
Actually I have one scatter plot and one bar plot (a timeline) as the two plots. I was trying to find out if I could make the scatter plot transparent and keep the bar one opaque.I know it sounds weird to convert a plot like scatter to become transparent but that's something one of my necessity for one of my project.
If you know if it is possible or not please suggest me how to do it or suggest me person who can guide me on this. I would be highly glad.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

KRUNAL
KRUNAL 2014년 8월 21일
If I have an image like this
Is it possible that only the top most or lower most of them has color or non-transparent and rest all have no color?

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by