diff --git a/src/gleplot/axes.py b/src/gleplot/axes.py index fce07e4..3316280 100644 --- a/src/gleplot/axes.py +++ b/src/gleplot/axes.py @@ -2382,7 +2382,9 @@ def legend(self, loc: str = "best", **kwargs): if "offset" in kwargs: # gleplot extension (not a matplotlib kwarg): displace the key # from its anchor by (dx, dy) IN CM, GLE's ``key ... offset``. - # Positive dy moves DOWN from the anchor, following GLE. + # GLE displaces INWARD from the anchored corner: for pos tr, + # positive dx moves LEFT and positive dy moves DOWN (verified by + # compiled pixel-diff; negative values can leave the canvas). offset = kwargs.pop("offset") if offset is None: self.legend_offset = None diff --git a/src/gleplot/writer.py b/src/gleplot/writer.py index ba27bee..a70a099 100644 --- a/src/gleplot/writer.py +++ b/src/gleplot/writer.py @@ -1382,8 +1382,12 @@ def add_legend( ``nobox``. offset : tuple of (float, float), optional Displacement of the key from its anchor, in cm, emitted as GLE's - ``offset dx dy``. GLE's convention: positive dx moves right, - positive dy moves down from the anchor. ``None`` omits the token. + ``offset dx dy``. GLE displaces the key INWARD from the anchored + corner (verified against GLE 4.3.10 by compiled pixel-diff): for a + right-anchored key positive dx moves LEFT, for a top-anchored key + positive dy moves DOWN. Negative values push the key outside the + graph and can move it off-canvas entirely. ``None`` omits the + token. Notes -----