How do I get the a/y axes labels to show correctly?
1 view (last 30 days)
Show older comments
W. Jeremy Morrison
on 29 Apr 2023
Commented: W. Jeremy Morrison
on 29 Apr 2023
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')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1369779/image.jpeg)
0 Comments
Accepted Answer
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')
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!