Hello,
The attached are a small subclass of matplotlib.text.Text I have
created which draws a (somewhat) fancy box around the text (see the
attached example ). This is similar to the current implementation of
bbox drawing in matpliotlib.text.Text class. A few differences are,
* how the rotation is handled. The box is also rotated
* optional shadow.
I also attach a small patch to text.py, which enables a use of a
custom bbox_artist.
A simple example,
from textbox import Text, TextBoxArtist, RoundBox
t = Text(0., 0., "test", size=20, rotation=30.,
bbox = dict(artist=TextBoxArtist(RoundBox()))
)
gca().add_artist(t)
With the text.py patch, you may do
from textbox import TextBoxArtist, RoundBox
gca().text(0., 0., "test", size=20, rotation=30.,
bbox = dict(artist=TextBoxArtist(RoundBox()))
)
More examples are found in the example file attached. And with some
creativity, you can make your own fancy box.
It would be good if these can be included in the matplotlib. At least,
can the patch for the text.py be applied?
Regards,
-JJ
textbox.tgz (2.72 KB)
text_bbox_artist.diff (587 Bytes)