From 52ab2f8803401dcb1d58b4053403fe8469afd4bc Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 4 Aug 2020 19:19:26 -0400 Subject: [PATCH] DOC: clarify that display space coordinates are not stable - add an inline comment above the transform call - promote the note to a warning --- tutorials/advanced/transforms_tutorial.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tutorials/advanced/transforms_tutorial.py b/tutorials/advanced/transforms_tutorial.py index fa52442b59b9..47ae908e2d5c 100644 --- a/tutorials/advanced/transforms_tutorial.py +++ b/tutorials/advanced/transforms_tutorial.py @@ -145,6 +145,9 @@ ax.set_ylim(-1, 1) xdata, ydata = 5, 0 +# This computing the transform now, if anything +# (figure size, dpi, axes placement, data limits, scales..) +# changes re-calling transform will get a different value. xdisplay, ydisplay = ax.transData.transform((xdata, ydata)) bbox = dict(boxstyle="round", fc="0.8") @@ -166,7 +169,7 @@ plt.show() ############################################################################### -# .. note:: +# .. warning:: # # If you run the source code in the example above in a GUI backend, # you may also find that the two arrows for the *data* and *display*