Hello, I am trying to set a bar (a patched series of
> rectangles) with a fill pattern instead of
> just a solid color. Is there an easy way to do this in
> I am thinking of something like Qt's QBrush which has cross,
> vertical, dense, etc. patterns.
There is no support for this currently -- it wouldn't bee too hard to
add for backends that support this kind of thing. Basically, we need
to specify the API for it, and add support to backends. I have been
wanting to add gradient fills for patches (eg polygons, rectangles)
and it would be good to do both at once.
I know Ted has mentioned a desire to plot ellipses avoiding the
discretizations caused by manually computing the vertices. When the
migration to proper path drawing in mpl is complete, this would be
possible with splines or by exposing a backend draw_ellipse method.
For simplicity of design, I'm inclined to the former, but if you have
any suggestions here, let me know.
> Also, could you please tell me how to plot a rotated
There is no built-in support for this, but you can do it "the hard
way" (example below).
I'm in the process of rethinking and refactoring the way mpl does
transformations, so if you have suggestions on how this could be done
better from an interface standpoint, please let me know. The code
below requires mpl CVS (but will be included in the next release,
from matplotlib.agg import trans_affine
from matplotlib.patches import Polygon
from matplotlib.numerix import sin, cos, pi, arange
rx = 2
ry = 1
angle = arange(0.0, 2*pi, 0.1)
xs = rx*cos(angle)
ys = ry*sin(angle)
a = 2*pi*10./360. # 10 degrees
trans = trans_affine(cos(a), sin(a), -sin(a), cos(a), 0.0, 0.0)
verts = [tuple(trans.transform(x,y)) for x,y in zip(xs,ys)]
poly = Polygon(verts)
ax = pylab.subplot(111)