'Make a compound path object to draw a number
of polygons with equal numbers of sides XY is a (numpolys x
numsides x 2) numpy array of vertices.  Return object is a
:class:`Path`
.. plot:: gallery/api/histogram_path.py'

@classmethod
def make_compound_path_from_polys(cls, XY):

    (numpolys, numsides, two) = XY.shape
    if (two != 2):
        raise ValueError(u"The    third    dimension    of    'XY'    must    be    2")
    stride = (numsides + 1)
    nverts = (numpolys * stride)
    verts = np.zeros((nverts, 2))
    codes = (np.ones(nverts, int) * cls.LINETO)
    codes[0::stride] = cls.MOVETO
    codes[numsides::stride] = cls.CLOSEPOLY
    for i in range(numsides):
        verts[i::stride] = XY[:, i]
    return cls(verts, codes)
