Changes for .kilo/legend_relocation_plan.md: 27 added lines, 0 removed lines.
Original line number
Diff line number
Diff line
# Plan: Relocate Legends for Overlay and Detrended Rows
## Motivation
Currently, legends for the model overlay and detrended rows are placed within the first subpanel (leftmost column). In multi-cluster/multi-instrument plots, this can clutter the data visualization in the first panel while leaving the right side of the figure underutilized.
To maintain consistency with the residual row—which uses a dedicated KDE inset axis on the right—the legends for the upper rows should be moved to a similar dedicated space. This improves visual balance and ensures that data in the first subpanel is not obscured by the legend.
## Objectives
1.**Modify Figure Layout**: Update `FigureLayoutManager` to expand the `GridSpec` by one column. This new rightmost column will be dedicated to legends for the `overlay` and `detrended` rows.
2.**Implement Legend Axes**: Create `legend_ax` for the overlay and detrended rows in the new column, ensuring `axis('off')` is called to keep them borderless.
3.**Update Overlay Rendering**: Modify `_render_rv_overlay` and `_render_lc_overlay` in `panel_overlay.py` to:
* Remove labels from the primary subpanels (set all to `_nolegend_`).
* Use the new dedicated `legend_ax` to render the legend, using `bbox_to_anchor` for precise centering.
4.**Update Detrended Rendering**: Apply similar logic to the detrended row rendering.
5.**Verification**: Ensure that the shift in `GridSpec` does not cause overlap between the new legends and the dynamically positioned KDE insets.