How do I get the a/y axes labels to show correctly?
조회 수: 4 (최근 30일)
이전 댓글 표시
I'm coding a project and want to output 4 plots together in a tiled layout. However two of the plots (the bottom two) only show 1 axis label and not the other. How do I fix this?
Attached below is the code for a tiled layout and the resulting figure:
% ECLIPJ2000
figure(11)
tcl = tiledlayout(2,2);
nexttile
plot3(state_f1_storage(1,:), state_f1_storage(2,:), state_f1_storage(3,:))
hold on
plot3(state_f1_storage(1,1),state_f1_storage(2,1),state_f1_storage(3,1), "og", "LineWidth", 2)
plot3(state_f1_storage(1,end),state_f1_storage(2,end),state_f1_storage(3,end), "rx", "LineWidth", 2)
ellipsoid(0,0,0,6.25,6.25,6.25)
hold off
xlabel('x (km)')
ylabel('y (km)')
zlabel('z (km)')
axis equal
grid on
nexttile
plot3(state_f1_storage(1,:), state_f1_storage(2,:), state_f1_storage(3,:))
hold on
plot3(state_f1_storage(1,1),state_f1_storage(2,1),state_f1_storage(3,1), "og", "LineWidth", 2)
plot3(state_f1_storage(1,end),state_f1_storage(2,end),state_f1_storage(3,end), "rx", "LineWidth", 2)
ellipsoid(0,0,0,6.25,6.25,6.25)
hold off
xlabel('x (km)')
ylabel('y (km)')
axis equal
grid on
view(0,90)
nexttile
plot3(state_f1_storage(1,:), state_f1_storage(2,:), state_f1_storage(3,:))
hold on
plot3(state_f1_storage(1,1),state_f1_storage(2,1),state_f1_storage(3,1), "og", "LineWidth", 2)
plot3(state_f1_storage(1,end),state_f1_storage(2,end),state_f1_storage(3,end), "rx", "LineWidth", 2)
ellipsoid(0,0,0,6.25,6.25,6.25)
hold off
xlabel('x (km)')
ylabel('z (km)')
axis equal
grid on
view(90,0)
nexttile
plot3(state_f1_storage(1,:), state_f1_storage(2,:), state_f1_storage(3,:))
hold on
plot3(state_f1_storage(1,1),state_f1_storage(2,1),state_f1_storage(3,1), "og", "LineWidth", 2)
plot3(state_f1_storage(1,end),state_f1_storage(2,end),state_f1_storage(3,end), "rx", "LineWidth", 2)
ellipsoid(0,0,0,6.25,6.25,6.25)
hold off
xlabel('y (km)')
ylabel('z (km)')
axis equal
grid on
view(0,0)
title(tcl,'ECLIPJ2000 Frame')

댓글 수: 0
채택된 답변
Image Analyst
2023년 4월 29일
You're not setting all the labels for those plots, specifically, you're not setting the vertical axis label for the bottom two plots. Try setting all 3 labels regardless of the view, and the view should show it correctly. We can't run your code because you didn't included the state_f1_storage variable.
% ECLIPJ2000
figure(11)
tcl = tiledlayout(2,2);
nexttile
plot3(state_f1_storage(1,:), state_f1_storage(2,:), state_f1_storage(3,:))
hold on
plot3(state_f1_storage(1,1),state_f1_storage(2,1),state_f1_storage(3,1), "og", "LineWidth", 2)
plot3(state_f1_storage(1,end),state_f1_storage(2,end),state_f1_storage(3,end), "rx", "LineWidth", 2)
ellipsoid(0,0,0,6.25,6.25,6.25)
hold off
xlabel('x (km)')
ylabel('y (km)')
zlabel('z (km)')
axis equal
grid on
nexttile
plot3(state_f1_storage(1,:), state_f1_storage(2,:), state_f1_storage(3,:))
hold on
plot3(state_f1_storage(1,1),state_f1_storage(2,1),state_f1_storage(3,1), "og", "LineWidth", 2)
plot3(state_f1_storage(1,end),state_f1_storage(2,end),state_f1_storage(3,end), "rx", "LineWidth", 2)
ellipsoid(0,0,0,6.25,6.25,6.25)
hold off
xlabel('x (km)')
ylabel('y (km)')
zlabel('z (km)')
axis equal
grid on
view(0,90)
nexttile
plot3(state_f1_storage(1,:), state_f1_storage(2,:), state_f1_storage(3,:))
hold on
plot3(state_f1_storage(1,1),state_f1_storage(2,1),state_f1_storage(3,1), "og", "LineWidth", 2)
plot3(state_f1_storage(1,end),state_f1_storage(2,end),state_f1_storage(3,end), "rx", "LineWidth", 2)
ellipsoid(0,0,0,6.25,6.25,6.25)
hold off
xlabel('x (km)')
ylabel('y (km)')
zlabel('z (km)')
axis equal
grid on
view(90,0)
nexttile
plot3(state_f1_storage(1,:), state_f1_storage(2,:), state_f1_storage(3,:))
hold on
plot3(state_f1_storage(1,1),state_f1_storage(2,1),state_f1_storage(3,1), "og", "LineWidth", 2)
plot3(state_f1_storage(1,end),state_f1_storage(2,end),state_f1_storage(3,end), "rx", "LineWidth", 2)
ellipsoid(0,0,0,6.25,6.25,6.25)
hold off
xlabel('x (km)')
ylabel('y (km)')
zlabel('z (km)')
axis equal
grid on
view(0,0)
title(tcl,'ECLIPJ2000 Frame')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Axes Appearance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!