From 59a5498daf2fd8323186569fff4cab247a27124e Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Fri, 9 Feb 2024 16:57:27 -0500 Subject: [PATCH] BUG: Update flight trajectory plot axes limits --- CHANGELOG.md | 1 + rocketpy/plots/flight_plots.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2523bcd9..9ef12213c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ You can install this version by running `pip install rocketpy==1.2.0` ### Fixed +- BUG: Update flight trajectory plot axes limits [#552](https://github.com/RocketPy-Team/RocketPy/pull/552) - MNT: small fixes before v1.2 [#550](https://github.com/RocketPy-Team/RocketPy/pull/550) - BUG: Elliptical Fins Draw [#548](https://github.com/RocketPy-Team/RocketPy/pull/548) - BUG: 3D trajectory plot not labeling axes [#533](https://github.com/RocketPy-Team/RocketPy/pull/533) diff --git a/rocketpy/plots/flight_plots.py b/rocketpy/plots/flight_plots.py index 05b969633..4ae5141c9 100644 --- a/rocketpy/plots/flight_plots.py +++ b/rocketpy/plots/flight_plots.py @@ -69,25 +69,23 @@ def trajectory_3d(self): min_x = min(self.flight.x[:, 1]) max_y = max(self.flight.y[:, 1]) min_y = min(self.flight.y[:, 1]) - max_xy = max(max_x, max_y) - min_xy = min(min_x, min_y) _ = plt.figure(figsize=(9, 9)) ax1 = plt.subplot(111, projection="3d") ax1.plot( - self.flight.x[:, 1], self.flight.y[:, 1], zs=0, zdir="z", linestyle="--" + self.flight.x[:, 1], self.flight.y[:, 1], zs=min_z, zdir="z", linestyle="--" ) ax1.plot( self.flight.x[:, 1], self.flight.altitude[:, 1], - zs=min_xy, + zs=min_y, zdir="y", linestyle="--", ) ax1.plot( self.flight.y[:, 1], self.flight.altitude[:, 1], - zs=min_xy, + zs=min_x, zdir="x", linestyle="--", ) @@ -114,9 +112,9 @@ def trajectory_3d(self): ax1.set_ylabel("Y - North (m)") ax1.set_zlabel("Z - Altitude Above Ground Level (m)") ax1.set_title("Flight Trajectory") - ax1.set_zlim3d([min_z, max_z]) - ax1.set_ylim3d([min_xy, max_xy]) - ax1.set_xlim3d([min_xy, max_xy]) + ax1.set_xlim(min_x, max_x) + ax1.set_ylim(min_y, max_y) + ax1.set_zlim(min_z, max_z) ax1.view_init(15, 45) ax1.set_box_aspect(None, zoom=0.95) # 95% for label adjustment plt.show()