Thanks John,
Sorry, this is too heavy for my programming skills.
I hope to be able to contribute some time later.


On Sat, Jul 11, 2009 at 7:55 PM, John Hunter <> wrote:
On Sat, Jul 11, 2009 at 9:55 AM, Eli Brosh<> wrote:
> Thanks John,
> A kwarg fillstyle with options 'full|top|bottom|left|right' for any marker
> is certainly better than what i have done.
> I just did not have an idea how to program this kwarg.
> Further, I can't see an easy way of generalizing the half-filling of
> markers.
> is there a better way than just programming each half-filled marker
> separately ?
> Perhaps if you can give me some hints, I can try to do the rest of the work.

Sure, first take a look at the coding guide, in particular these two
sections which introduce kwarg processing and documentation

Basically, any new "property", where I use quotes because mpl
properties are not the same as python properties, needs a setter and
getter.  The setter must also have an ACCEPTS flag, which gives the
acceptable arguments.  mpl uses these in the setp and getp
introspection facilities, as well as in the auto-table building of
kwargs in the docs.  The artist.ArtistInspector is used to insepct the
functions and docs to extract the properties:

I've committed a patch to svn that implements the fillstyle property
for Line2D, and implemented it for draw_square.  The other filled
markers raise a NotImplementedError if the fillstyle is not 'full',
and that is where you come in.  The basic implementation is to draw
two half markers, one filled and one unfilled, and use the rotation
property of the transformation to support the various
left|right|bottom|top.  Here is the reference implementation for

   def _draw_square(self, renderer, gc, path, path_trans):
       gc.set_snap(renderer.points_to_pixels(self._markersize) >= 2.0)
       side = renderer.points_to_pixels(self._markersize)
       transform = Affine2D().translate(-0.5, -0.5).scale(side)
       rgbFace = self._get_rgb_face()
       fs = self.get_fillstyle()
       if fs=='full':
           renderer.draw_markers(gc, Path.unit_rectangle(), transform,
                                 path, path_trans, rgbFace)
           # build a bottom filled square out of two rectangles, one
           # filled.  Use the rotation to support left, right, bottom
           # or top
           if fs=='bottom': rotate = 0.
           elif fs=='top': rotate = 180.
           elif fs=='left': rotate = 270.
           else: rotate = 90.

           bottom = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 0.5], [0.0,
0.5], [0.0, 0.0]])
           top = Path([[0.0, 0.5], [1.0, 0.5], [1.0, 1.0], [0.0,
1.0], [0.0, 0.05]])
           transform = transform.rotate_deg(rotate)
           renderer.draw_markers(gc, bottom, transform,
                                 path, path_trans, rgbFace)
           renderer.draw_markers(gc, top, transform,
                                 path, path_trans, None)

See examples/pylab_examples/ in svn, and the attached
patch (although this is already committed, it might be instructional
so you can see the steps needed to add a new property).  When you
finish the others, send along an svn diff and some more examples in
the fillstyle_demo and I'll commit it.