Found my answer: rectprops = { 'fill': True, 'facecolor':
> 'w', 'edgecolor': 'w' } t.set_bbox( rectprops = rectprops
> )
> Does anyone find the documentation extremely sparse? I am
> new to this library and while find the OO design pretty
> good, struggle with what's on
> http://matplotlib.sourceforge.net/classdocs.html. Is
> there more?
Known problem, it's on the list of things to do, documentation patches
welcome.
> In this case I had to-- View the text.py to see what
> set_bbox and draw do, created a Rectangle and print its
> __dict__ to see what it's attributes are, realize I must
> strip leading '_' by seeing how update works in artist.py,
> just to write two lines of code.
And good way to approach this kinds of thing is to have an
interactive shell open and use the setp and getp functionality to
inspect an artist for it's properties. In this case you want to see
what the valid properties are for a Rectangle
In [7]: from matplotlib.patches import Rectangle
In [10]: r = Rectangle(1,1,(1,1))
In [11]: getp(r)
alpha = 1.0
animated = False
antialiased or aa = True
clip_box = None
clip_on = False
edgecolor or ec = black
facecolor or fc = blue
figure = None
fill = 1
height = (1, 1)
label =
linewidth or lw = 1.0
transform = <Affine object at 0x89c9d24>
visible = True
width = 1
x = 1.0
zorder = 1
setp will give you information on the valid values for properties
In [12]: setp(r)
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
bounds: (left, bottom, width, height)
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
edgecolor or ec: any matplotlib color - see help(colors)
facecolor or fc: any matplotlib color - see help(colors)
figure: a matplotlib.figure.Figure instance
fill: [True | False]
height: float
label: any string
linewidth or lw: float
lod: [True | False]
transform: a matplotlib.transform transformation instance
visible: [True | False]
width: float
x: float
y: float
zorder: any number
Alternatively, if you understand how the properties system works, you
can use the classdocs. Any method which starts with set_somename is
associated with a property somename. So you'll see set_facecolor,
set_edgecolor and friends in Rectangle and it's base classes.
JDH