How do I get the a/y axes labels to show correctly?

4 ビュー (過去 30 日間)
W. Jeremy Morrison
W. Jeremy Morrison 2023 年 4 月 29 日
コメント済み: W. Jeremy Morrison 2023 年 4 月 29 日
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')

採用された回答

Image Analyst
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')
  1 件のコメント
W. Jeremy Morrison
W. Jeremy Morrison 2023 年 4 月 29 日
Genius!!! And that makes a lot of sense because it is still a 3D plot even if I view it in a 2D plane view, which I didn't realize.
Thank you so much! It works perfectly now.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxes Appearance についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by