From: Manuel Metz <mmetz@as...> - 2006-09-20 16:48:40
first of all "scatter_custom_symbol.py" is great ! I really like this.
May I express some idea/suggestions concerning custom symbols:
I came from supermongo to matplotlib. And I liked the way you could
define symbols in supermongo:
PTYPE n s
where "s" gives the style of the symbol:
s = 0 open
s = 1 skeletal; all vectices are connected to the centre
s = 2 starred
s = 3 solid
and "n" is a the number of sides the polygon has. For example:
PTYPE 4 0
creates open squares whereas
PTYPE 4 1
creatse X-like symbol. Btw. I like those unfilled symbols because you
can plot lots of them without overcrowding your figure.
It is also possible to use
PTYPE 0 0
which draws the smalles possible dots on a device, i.e. a single pixel
on a screen; this can also be very helpful if you want to plot lots of
One can also use an angle argument, e.g. transform a 'X' symbol to an
'+' symbol by rotation it about 45 degrees.
Is it possible to integrate a similar way to create custom symbols in
matplotlib? Probably something like
verts = PolyMarker(n=4,s='open',angle=0)
would be nice. Or, if I write something like this myself, is there any
chance to add this to matplotlib ?
John Hunter wrote:
>>>>>> "Manuel" == Manuel Metz <mmetz@...> writes:
> Manuel> would be nice. Or, if I write something like this myself,
> Manuel> is there any chance to add this to matplotlib ?
I personally find it a little bit confusing to have the option to define
a marker-symbol via two different keywords: marker and verts. Isn't it
possible and more natural to use the same keyword (maker) for multiple
Hm , how about the following ideas:
- remove keyword verts again
- check type of argument of marker
-> string: behave as before
-> a list or a tuple that may be
(numsides, style, [optional angle])
(verts, style, [optional angle])
- then it would be possible to define a custom symbol giving the number
of sides it should have + a style (i.e, filled or starred)
- to define a custom symbol using a list of (x,y) points
I have fiddled a little bit around with matplotlib/axes.py and attach a
file that contains a modified version of the function scatter() in
axes.py, as well as a little script and it's output.
What is missing - and I haven't tried that - is to add a class similar
to RegularPolyCollection for Lines allowing for none-filled symbols.
This should/could produce star-like symbols. Adding the option style for
verts would also allow e.g. S-shaped line-symbols (-> Create a
LineCollection instead of a PolyCollection).
As you can see in the modified scatter function, I also added a
rescaling for 'verts'. This rescaling assumes that the vertices are
centred on the coordinate origin (or if not, one has the option to
systematically displace symbols !), and rescales them such that the
largest distance from the origin is 1.
I hope this is somehow helpful ...!?