From: Manuel M. <mm...@as...> - 2006-10-10 09:52:10
|
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. These symbols can be used with the scatter() function. I modified the scatter function somewhat, but keeping the API compatible. It is now easily possible to create a greater variety of symbols: - scatter(x,y,marker="[marker caracter]") behaves as before - scatter (x,y,marker=None, verts=[list of verts]) behaves as before - [NEW] scatter(x,y,marker=(N,0,[angle])) produces a scatter plot with a N-sided regular solid polygone - [NEW] scatter(x,y,marker=(N,1,[angle])) produces a scatter plot with a N-sided star-like symbol (using the class StaredRegularPolyCollection) - [NEW] scatter(x,y,marker=(verts,0)) produces a scatter plot like scatter(x,y,marker=None,verts=verts) So, marker can now be: - a single character as before - a tuple (or list): (numsides, style, [optional angle]) - with style=[int] = 0: solid polygone = 1: stared polygone (define this as constants somewhere ?) - (verts, style); actually style is ignored for this option, but see below This approach allows for easy future extension, e.g. a style 2(=lines) may be added which allows for none-closed symbols which can be very useful to create "S"-shaped symbols. Another possibility would be to interpred marker=(0,0) to plot only single points instead of Polygons. This can be useful when plotting a large number of data-points, e.g. stars in an N-Body simulation of a galaxy collision. I also attached an example file, scatter_example.py, and its output, scatter_example.png. |