Skip to content

Commit 34c0273

Browse files
authored
ENH: Changing ellipses plot axis label (#855)
* ENH: Changed the ellipses labels * ENH: Adjusted the relative positioning so it doesn't rescale with border size * ENH: Changed the ellipses labels * ENH: Adjusted the relative positioning so it doesn't rescale with border size * DOC: Updated the CHANGELOG
1 parent 973398c commit 34c0273

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Attention: The newest changes should be on top -->
3939
- ENH: Discretized and No-Pickle Encoding Options [#827](https://github.com/RocketPy-Team/RocketPy/pull/827)
4040
- ENH: Add the Coriolis Force to the Flight class [#799](https://github.com/RocketPy-Team/RocketPy/pull/799)
4141
- ENH: Improve parachute geometric parametrization [#835](https://github.com/RocketPy-Team/RocketPy/pull/835)
42+
- ENH: Changing ellipses plot axis label [#855](https://github.com/RocketPy-Team/RocketPy/pull/855)
4243

4344
### Changed
4445

rocketpy/plots/monte_carlo_plots.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import matplotlib.pyplot as plt
2+
from matplotlib.transforms import offset_copy
23
import numpy as np
34

45
from ..tools import generate_monte_carlo_ellipses, import_optional_dependency
@@ -114,9 +115,20 @@ def ellipses(
114115
)
115116

116117
plt.legend()
118+
117119
ax.set_title("1$\\sigma$, 2$\\sigma$ and 3$\\sigma$ Monte Carlo Ellipses")
118-
ax.set_ylabel("North (m)")
119-
ax.set_xlabel("East (m)")
120+
north_south_offset = offset_copy(
121+
ax.transAxes, fig=plt.gcf(), x=-72, y=0, units="points"
122+
)
123+
east_west_offset = offset_copy(
124+
ax.transAxes, fig=plt.gcf(), x=0, y=-30, units="points"
125+
)
126+
ax.text(0, 0, "West", va="bottom", ha="center", transform=east_west_offset)
127+
ax.text(1, 0, "East", va="bottom", ha="center", transform=east_west_offset)
128+
ax.text(0, 0, "South", va="bottom", ha="left", transform=north_south_offset)
129+
ax.text(0, 1, "North", va="top", ha="left", transform=north_south_offset)
130+
ax.set_ylabel("Y (m)")
131+
ax.set_xlabel("X (m)")
120132

121133
# Add background image to plot
122134
# TODO: In the future, integrate with other libraries to plot the map (e.g. cartopy, ee, etc.)

0 commit comments

Comments
 (0)