One window and two plots using command plot3

I think my code is OK, but I would like to show that my plots are using the same x axis.
Here is my code:
set(gcf,'position',[pos1_graph,pos2_graph,pos3_graph,pos4a_graph])
[ha, pos] = tight_subplot(2,1,[.03 .01],[.1 .05],[.1 .05]) ;
axes(ha(1))
x0=time;
y0=1*ones(size(x0))';
z0=Inertial_cont;
x1a=[t_slp1;t_slp1(end)+0.0005];
y1a=0.6*ones(size(t_slp1)+1)';
z1a=[Inertia_slp1;0];
x2a=[t_slp2;t_slp2(end)+0.0005];
y2a=0.7*ones(size(t_slp2)+1)';
z2a=[Inertia_slp2;0];
x3a=[t_slp3;t_slp3(end)+0.0005];
y3a=0.8*ones(size(t_slp3)+1)';
z3a=[Inertia_slp3;0];
x4a=[t_slp4;t_slp4(end)+0.0005];
y4a=0.9*ones(size(t_slp4)+1)';
z4a=[Inertia_slp4;0];
plot3(x0,y0,z0)
hold on;
fill3(x1a,y1a,z1a,'r')
fill3(x2a,y2a,z2a,'m')
fill3(x3a,y3a,z3a,'y')
fill3(x4a,y4a,z4a,'g')
alpha(.4)
grid on;
view(10,40)
set(gca,'xticklabel',{[]})
zlabel('Power (MW)')
axis([4 9 0.6 1 0 40])
yticklabels({'P_{win1a}','P_{win2a}','P_{win3a}','P_{win4a}','P_{t}'})
axes(ha(2))
x0=time;
y0=1*ones(size(x0))';
z0=PMEC_inj_total;
x1a=[t_slp1;t_slp1(end)+0.0005];
y1a=0.6*ones(size(t_slp1)+1)';
z1a=[Gov_slp1;0];
x2a=[t_slp2;t_slp2(end)+0.0005];
y2a=0.7*ones(size(t_slp2)+1)';
z2a=[Gov_slp2;0];
x3a=[t_slp3;t_slp3(end)+0.0005];
y3a=0.8*ones(size(t_slp3)+1)';
z3a=[Gov_slp3;0];
x4a=[t_slp4;t_slp4(end)+0.0005];
y4a=0.9*ones(size(t_slp4)+1)';
z4a=[Gov_slp4;0];
plot3(x0,y0,z0)
hold on;
fill3(x1a,y1a,z1a,'r')
fill3(x2a,y2a,z2a,'m')
fill3(x3a,y3a,z3a,'y')
fill3(x4a,y4a,z4a,'g')
alpha(.4)
grid on;
view(10,40)
xlabel('time (s)')
zlabel('Power (MW)')
axis([4 9 0.6 1 0 40])
yticklabels({'P_{win1a}','P_{win2a}','P_{win3a}','P_{win4a}','P_{t}'})
Thanks for your kind comments.

댓글 수: 13

Why are you clearing this up?
set(gca,'xticklabel',{[]})
Indira
Indira 2019년 9월 4일
Hi Darova,
Thanks for your answer. I got that in the middle of my code as you can see above. However, I don't know if the perspective or something else can be ajusted in order to show both as they have the same x axis.
darova
darova 2019년 9월 4일
Can you attach your whole code and data?
Indira
Indira 2019년 9월 4일
untitled.jpg
Indira
Indira 2019년 9월 4일
편집: Indira 2019년 9월 4일
Thanks Davora.
Both data are at the same time scales, but due to the perspective they seem to have a different x axis.
darova
darova 2019년 9월 4일
You want them to have the same size?
Untitled.png
Indira
Indira 2019년 9월 4일
I want both graphics, the upper and lower, look with the same x axis since they are happening at the same time (from 4 seconds to 9 seconds). First, I tried to remove the x axis from the upper one, but it didn't help. I think it might be a question of perspective, I don't know.
Indira
Indira 2019년 9월 4일
This is using: set(gca,'xticklabel',{[]})untitled2.jpg
darova
darova 2019년 9월 4일
I don't understand. They doesn't look at the same x axis?
21Untitled.png
Maybe you can show on the image what are you trying to do?
Indira
Indira 2019년 9월 4일
Yes, they have the same axis.
I know it might be not possible but if they were 2D plot it can be easily seen that the upper and lower graphics are aligned second by second. I wonder if there is a way to do the same with plot3.
Thanks!
darova
darova 2019년 9월 4일
Can you show on the image what do you want?
Indira
Indira 2019년 9월 4일
Sadly, I don't have any reference. I am just trying to figure out what could be the best way to present my results. Any advice will be helpful. Thanks!
Jan
Jan 2019년 9월 4일
I do not understand, what you are asking for: "show that my plots are using the same x axis". Why not simply using the same x axis?

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2019년 8월 29일

댓글:

Jan
2019년 9월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by