Skip to content

Commit 4a327d5

Browse files
author
Hanna Ruth
committed
FIX: updated plotting for center of rotation estimate to have the same ylims for slice plotting.
1 parent e17545a commit 4a327d5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/llama/estimate_center.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,13 @@ def plot_center_of_rotation_estimate_results(
154154
ax[1, 1].legend()
155155
ax[1, 1].grid(linestyle=":")
156156

157-
# ax[0, 1].axis('off') # Turn off the axis for the empty subplot
157+
y_ranges = (np.diff(ax[1, 0].get_ylim()), np.diff(ax[1, 1].get_ylim()))
158+
idx_max = np.argmax(y_ranges)
159+
shared_range = y_ranges[idx_max] / 2 * np.array([-1, 1])
160+
if idx_max == 0:
161+
ax[1, 1].set_ylim(np.mean(ax[1, 1].get_ylim()) + shared_range)
162+
elif idx_max == 1:
163+
ax[1, 0].set_ylim(np.mean(ax[1, 0].get_ylim()) + shared_range)
158164

159165
# Adjust layout
160166
plt.tight_layout()

0 commit comments

Comments
 (0)