Here is the explanation for the code:
- nsizes and npts specifies the number of sizes and number of items in the collection. If nsizes is less than npts for the remaining points, nsizes would start from the beginning and the cycle goes on. The same holds true for colors as well.
- xx = r * np.sin(theta) computes the actual size for all nsizes.
- xyo = list(zip(xo, yo)) computes x and y co-ordinates for each of the items in the collection. zip is a Python function that takes items from two or more lists and creates tuples of two or more each.
- col = collections.RegularPolyCollection() creates the collection of polygons. Number 6 is the number of sides of the polygon, and np.fabs() converts all the numbers in xx to their absolute ...