Skip to content

Commit 3bbe340

Browse files
committed
ENH: Adjusted the relative positioning so it doesn't rescale with border size
1 parent b9a186a commit 3bbe340

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

rocketpy/plots/monte_carlo_plots.py

Lines changed: 12 additions & 4 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,11 +115,18 @@ def ellipses(
114115
)
115116

116117
plt.legend()
118+
117119
ax.set_title("1$\\sigma$, 2$\\sigma$ and 3$\\sigma$ Monte Carlo Ellipses")
118-
ax.text(0, -0.1, "West", va="bottom", ha="center", transform=ax.transAxes)
119-
ax.text(1, -0.1, "East", va="bottom", ha="center", transform=ax.transAxes)
120-
ax.text(-0.12, 0, "South", va="bottom", ha="left", transform=ax.transAxes)
121-
ax.text(-0.12, 1, "North", va="top", ha="left", transform=ax.transAxes)
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)
122130
ax.set_ylabel("Y (m)")
123131
ax.set_xlabel("X (m)")
124132

0 commit comments

Comments
 (0)