Plotting far away objects in a 3D plot
古いコメントを表示
I have the 3D plot of an orbit around the Earth and the surface plot of the Earth itself. I want to see the Sun in the right spot too, but if I plot the surface plot of the Sun, the plot zooms out too much. I want to see only objects near Earth, while being able to spot the Sun in the distance. Do you have any tips to achieve that?
I have the relative position of the Sun wrt the Earth, the Earth center is the origin of the plot.
P.S.: I can zoom in the plot but results are not nearly good enough. Earth is so small that the zoom stops working before reaching it
This is the plot as of now:

This is the plot without the Sun:

This is the code (plot only):
figure('Color','k');
%rotate3d;
% Black background and planets
%background('Black');
%hold on
% Celestial bodies
p3Dopts.Units = 'km';
%p3Dopts.RotAngle = 180;
planet3D('Earth', p3Dopts);
hold on
%p3Dopts.Position = rSun(1,:)';
%planet3D('Sun', p3Dopts);
% Flight path
scatter3( Y(:,1), Y(:,2), Y(:,3), 6, scaledT)
xlabel('x [km]'); ylabel('y [km]'); zlabel('z [km]');
ylim([-40000,40000]);
title('Earth equatorial frame', 'FontSize', 14);
cbar = colorbar; cbar.Color = 'w'; cbar.Title.Color = 'w';
cbar.Title.String = strcat('Time [',Tname,']');
clim([min(scaledT);max(scaledT)])
axis equal;
grid on;
ax = gca; ax.Color = 'k'; ax.GridColor = 'w';
ax.GridAlpha = 0.45; ax.XColor = 'w'; ax.YColor = 'w';
ax.ZColor = 'w';
hold off
採用された回答
その他の回答 (1 件)
Karim
2022 年 12 月 25 日
0 投票
Those are some amazing plots!
One method that could work is to insert a "break" in the axis, i.e. hiding a part of the space between the sun and the earth.
You can find some information here --> Breaking a plot to improve visualization » File Exchange Pick of the Week - MATLAB & Simulink (mathworks.com)
And the file exchange code here --> BreakPlot - File Exchange - MATLAB Central (mathworks.com)
カテゴリ
ヘルプ センター および File Exchange で Earth and Planetary Science についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!