Skip to content

Commit 0debea7

Browse files
author
Gorshanov Vadim
committed
Use truly relative axis position when needed
1 parent 0ba5374 commit 0debea7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tikzplotlib/_text.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def draw_text(data, obj):
5959

6060
if obj.axes:
6161
# If the coordinates are relative to an axis, use `axis cs`.
62-
tikz_pos = f"(axis cs:{pos[0]:{ff}},{pos[1]:{ff}})"
62+
rel = "rel " if abs(pos[0]) < 1 and abs(pos[1]) < 1 else ""
63+
tikz_pos = f"({rel}axis cs:{pos[0]:{ff}},{pos[1]:{ff}})"
6364
else:
6465
# relative to the entire figure, it's a getting a littler harder. See
6566
# <http://tex.stackexchange.com/a/274902/13262> for a solution to the

0 commit comments

Comments
 (0)