 # Patches in polar axes ?

Hello,

How complicated would it be to obtain the add_patch() capability in polar axes? Right now, the script

···

--------------------
from pylab import *
import matplotlib.patches as patches

ax = axes( [0.1, 0.1, 0.8, 0.8], polar = True )
ptch = patches.RegularPolygon( (pi/2,.5), 5, orientation = 20 )
show()
--------------------

fails, Python complaining that polar axes don't have an add_patch() method.

Now, I believe if we simply mimic what's in the Axes class and try to use

artists.extend(patches)

in PolarAxes, the coordinates are going to be all wacko.

The following works for me, and I wonder whether it is a useful addition to PolarAxes (sorry for the wrapped lines):

--------------------
from matplotlib.pylab import *

def RegularPolygon_polar( ax, xy, numVertices, radius = 5, orientation = 0, **kwargs ):
import matplotlib.patches as patches
import matplotlib.transforms as transforms

ptch = patches.RegularPolygon( (0,0),
numVertices,
orientation = orientation,
**kwargs )

trans = transforms.identity_affine()
trans.set_offset( xy, ax.transData )
ptch.set_transform( trans )
return ptch

ax = axes( [0.1, 0.1, 0.8, 0.8], polar = True )
ptch = RegularPolygon_polar( ax, (150*pi/180,.5), 5, radius = 10, orientation = 80 )