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

1 view (last 30 days)
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')

Accepted Answer

Image Analyst
Image Analyst on 29 Apr 2023
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 Comment
W. Jeremy Morrison
W. Jeremy Morrison on 29 Apr 2023
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.

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!