I'm trying to make a shadow effect behind text boxes in a plot (similarly to
what can be done with legends).

After a fair bit of searching around I found the matplotlib.patches.Shadow
class which seems to be good for this. But I cannot get it to work properly.
I suspect it has something to do with different transforms being used for
the text itself and the actual bbox that surrounds it. This is what I have
tried:

import numpy as n
import pylab as p
import matplotlib.patches as pt

p.figure()
p.plot([0,1],[0,1])
ax=p.gca()
tb=p.text(0.9,0.2,'test',horizontalalignment='center',verticalalignment='center',fontsize='small',
     
color='green',weight='bold',bbox=dict(boxstyle="round,pad=0.5",ec='black',fill=False))
bb=tb.get_bbox_patch()
sh=pt.Shadow(bb,0.1,0.1)
ax.add_patch(sh)
p.draw()
p.show()

This seems to produce nothing at all (or maybe something that is far outside
the axis limits).
Am I missing something obvious here? Is there some other method that will do
this in an easier way?

Would appreciate any help, cheers
-- 
View this message in context: 
http://old.nabble.com/text-box-shadow-tp27224851p27224851.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to