Skip to content

Commit e4e67f4

Browse files
Merge pull request #552 from RocketPy-Team/bug/3d-trajectory-plot
BUG: Update flight trajectory plot axes limits
2 parents b221d88 + 3330c5a commit e4e67f4

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ You can install this version by running `pip install rocketpy==1.2.0`
7070

7171
### Fixed
7272

73+
- BUG: Update flight trajectory plot axes limits [#552](https://github.com/RocketPy-Team/RocketPy/pull/552)
7374
- BUG: fix `get_controller_observed_variables` in the air brakes examples [#551](https://github.com/RocketPy-Team/RocketPy/pull/551)
7475
- MNT: small fixes before v1.2 [#550](https://github.com/RocketPy-Team/RocketPy/pull/550)
7576
- BUG: Elliptical Fins Draw [#548](https://github.com/RocketPy-Team/RocketPy/pull/548)

rocketpy/plots/flight_plots.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,23 @@ def trajectory_3d(self):
6969
min_x = min(self.flight.x[:, 1])
7070
max_y = max(self.flight.y[:, 1])
7171
min_y = min(self.flight.y[:, 1])
72-
max_xy = max(max_x, max_y)
73-
min_xy = min(min_x, min_y)
7472

7573
_ = plt.figure(figsize=(9, 9))
7674
ax1 = plt.subplot(111, projection="3d")
7775
ax1.plot(
78-
self.flight.x[:, 1], self.flight.y[:, 1], zs=0, zdir="z", linestyle="--"
76+
self.flight.x[:, 1], self.flight.y[:, 1], zs=min_z, zdir="z", linestyle="--"
7977
)
8078
ax1.plot(
8179
self.flight.x[:, 1],
8280
self.flight.altitude[:, 1],
83-
zs=min_xy,
81+
zs=min_y,
8482
zdir="y",
8583
linestyle="--",
8684
)
8785
ax1.plot(
8886
self.flight.y[:, 1],
8987
self.flight.altitude[:, 1],
90-
zs=min_xy,
88+
zs=min_x,
9189
zdir="x",
9290
linestyle="--",
9391
)
@@ -114,9 +112,9 @@ def trajectory_3d(self):
114112
ax1.set_ylabel("Y - North (m)")
115113
ax1.set_zlabel("Z - Altitude Above Ground Level (m)")
116114
ax1.set_title("Flight Trajectory")
117-
ax1.set_zlim3d([min_z, max_z])
118-
ax1.set_ylim3d([min_xy, max_xy])
119-
ax1.set_xlim3d([min_xy, max_xy])
115+
ax1.set_xlim(min_x, max_x)
116+
ax1.set_ylim(min_y, max_y)
117+
ax1.set_zlim(min_z, max_z)
120118
ax1.view_init(15, 45)
121119
ax1.set_box_aspect(None, zoom=0.95) # 95% for label adjustment
122120
plt.show()

0 commit comments

Comments
 (0)