custom symbol patch

John Hunter wrote:

    >>
    > Hi, I just submitted a patch to sourceforge and also
    > attached it to this email:
    >>
    > The applied patch modifies the files axes.py and
    > collections.py.
    >>
    > I added a class StaredRegularPolyCollection() to
    > collections.py to create star-like regular Polygons.
    >> This looks very useful -- thanks for the patch. To questions:
    >>
    >> What does the name "StaredRegularPolygon" mean? I am having
    >> trouble figuring out the Stared part.

    > Argh - okay - this is a mistranslation from german to
    > english - sorry. I wanted to say "starlike". So probably
    > StarlikeRegularPolygon is a better name...

OK, I see. Perhaps we should just call it a StarPolygonCollection

Also, in your patch, unless I am missing something, it looks like you
could simply do something like

        scale = 0.5/math.sqrt(math.pi)
        r = scale*ones(self.numsides*2)

rather than

+ r = 1.0/math.sqrt(math.pi) # unit area
+ r = asarray( [r]*(self.numsides*2) )
+ for i in xrange(1,len(r),2):
+ r[i] *= 0.5

Ie, do everything in numerix, rather than in python.

When you get all of this incorporated, if you could send one patch
against svn that includes all of the changes I'll check it in (if
noone else has any corrections or comments).

Thanks again,
JDH

John Hunter wrote:

    > Argh - okay - this is a mistranslation from german to
    > english - sorry. I wanted to say "starlike". So probably
    > StarlikeRegularPolygon is a better name...

OK, I see. Perhaps we should just call it a StarPolygonCollection
Star polygon - Wikipedia

I've done that.

Also, in your patch, unless I am missing something, it looks like you
could simply do something like

        scale = 0.5/math.sqrt(math.pi)
        r = scale*ones(self.numsides*2)

rather than

+ r = 1.0/math.sqrt(math.pi) # unit area
+ r = asarray( [r]*(self.numsides*2) )
+ for i in xrange(1,len(r),2):
+ r[i] *= 0.5

Ie, do everything in numerix, rather than in python.

There is a subtle but essential difference :wink: :
  for i in xrange(1,len(r), 2 )
                                 ^^^
, i.e. every second value gets rescaled. But there is probably a more
"pythonic" way to do that:

  r = 1.0/math.sqrt(math.pi) # unit area
        r = asarray( [r,0.5*r]*self.numsides )

I'm not aware of a better way to do this with numerix :frowning:

The patch against the latest svn revision (2810) is attached.

Manuel

custom_symbol.b.patch (7.45 KB)

···

When you get all of this incorporated, if you could send one patch
against svn that includes all of the changes I'll check it in (if
noone else has any corrections or comments).

Thanks again,
JDH