On Wed, Jan 16, 2013 at 7:07 AM, Daniele Nicolodi <[email protected]>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?
>

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
------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to