Hello,
I use matplotlib.pyplot.text() to annotate my plots.
When annotating reference lines on simple x,y plots I find it quite
annoying to have to manually compute an offset in data coordinates to
have some spacing between the line I'm labeling and the label itself.
With the bbox={'pad': padding} argument it is possible to have some
padding between the text and its container, however the annotation
position is still computed accordingly to the text content and not
accordingly to the bounding box.
Does exist a way to have the text position computed accordingly to the
bounding box, or, alternatively, to have some padding inserted between
the annotation coordinates and the actual placement of the text label?
Thank you in advance.
Best,
Daniele
The annotate method of the axes allows you to specify text as an offset.
Kind of a cumbersome method, but here's the example that uses offset
heavily:
http://matplotlib.org/examples/pylab_examples/annotation_demo2.html
And this example actually offsets from the text bbox:
http://matplotlib.org/examples/pylab_examples/annotation_demo3.html
-paul
ยทยทยท
On Wed, Jan 16, 2013 at 7:07 AM, Daniele Nicolodi <daniele@...3138...>wrote:
Hello,
I use matplotlib.pyplot.text() to annotate my plots.
When annotating reference lines on simple x,y plots I find it quite
annoying to have to manually compute an offset in data coordinates to
have some spacing between the line I'm labeling and the label itself.
With the bbox={'pad': padding} argument it is possible to have some
padding between the text and its container, however the annotation
position is still computed accordingly to the text content and not
accordingly to the bounding box.
Does exist a way to have the text position computed accordingly to the
bounding box, or, alternatively, to have some padding inserted between
the annotation coordinates and the actual placement of the text label?