Open andreassch opened 7 years ago
Can confirm the bug. Also adding "rel" before the axis solved the issue. For me the scale is 0.7 which looks good.
A fix for me which had no side effects as far as I can see is changing this line:
tikz_pos = f"(axis cs:{pos[0]:{ff}},{pos[1]:{ff}})"
in _text.py to:
tikz_pos = f"(rel axis cs:{pos[0]:{ff}},{pos[1]:{ff}})"
Probably obvious, but the same error appears with the plt.annotate
command as well.
Relative axis coordinates in text objects in matplotlib via
transform=plt.gca().transAxes
are not taken over in the generated pgfplots figure.Python code for minimal example:
The resulting matplotlib figure is: But the compiled pgfplots figure is:
The generated pgfplots code is:
The expected code in the \node command would be
\node at (rel axis cs:0.5,0.5)
to respect the relative coordinate system. Moreover, I would not expect the text to be scaled (i.e. noscale=0.5
key).