## Re: [Matplotlib-users] problem with new symbols

 Re: [Matplotlib-users] problem with new symbols From: Eric Emsellem - 2006-05-19 15:20:11 ``` great!

a quick one then: how would you then do to have a marker symbols where some part of the polygon is not attached to the rest (a vertical line plus an ellipse for example). I could do that using two different markers and plotting them one after the other, but is there a simpler way?

thanks
Eric

John Hunter wrote:
"Eric" == Eric Emsellem <emsellem@...> writes:
Eric> Hi again, I am trying to see if I could produce a scatter     Eric> plot (using "scatter" or "plot") but using NEW symbols (so     Eric> not already available in the list provided). I would like to     Eric> design new symbols (in some way which is to be defined) so     Eric> that scatter and/or plot would be able to use them.     Eric> Examples: horizontal or vertical or even rotated ellipses,     Eric> icon sketched galaxy-looking symbols, ...      Eric> Any hint on how to do this?      Eric> thanks in advance for any help here!      Eric> Eric P.S.: I already posted a similar question a few days     Eric> ago, so forgive me for this repetition...  persistence wins the day!  I added an option to scatter to support custom markers.  You pass in a list if x,y vertices for the polygon you want to use as the marker.  I haven't quite worked out the scaling yet, so for now use scale arguments that look right and understand that this may change when we get the scaling issue cleaned up.  I added an example to svn revision 2402 examples/scatter_custom_symbol.py.  Here it is, using an ellipse    from pylab import figure, nx, show    # unit area ellipse   rx, ry = 3., 1.   area = rx * ry * nx.pi   theta = nx.arange(0, 2*nx.pi+0.01, 0.1)   verts = zip(rx/area*nx.cos(theta), ry/area*nx.sin(theta))    x,y,s,c = nx.rand(4, 30)   s*= 10**2.      fig = figure()   ax = fig.add_subplot(111)   ax.scatter(x,y,s,c,marker=None,verts =verts)    show()  One thing we can do to make this more user friendly is to add new symbols to the scatter symbol table, eg  'wellipse' : a wide ellipse 'tellipse' : a tall ellipse  and map names to sequences of vertices.  So as you create the custom symbols you want to use, send them to me and I'll add them to the defaults, where appropriate.  Cheers, JDH

--  ==================================================================== Eric Emsellem                             emsellem@...                            Centre de Recherche Astrophysique de Lyon 9 av. Charles-Andre                        tel: +33 (0)4 78 86 83 84 69561 Saint-Genis Laval Cedex              fax: +33 (0)4 78 86 83 86 France                    http://www-obs.univ-lyon1.fr/eric.emsellem; ====================================================================
```

### Thread view

 [Matplotlib-users] problem with new symbols From: Eric Emsellem - 2006-05-19 10:12:22 ```Hi again, I am trying to see if I could produce a scatter plot (using "scatter" or "plot") but using NEW symbols (so not already available in the list provided). I would like to design new symbols (in some way which is to be defined) so that scatter and/or plot would be able to use them. Examples: horizontal or vertical or even rotated ellipses, icon sketched galaxy-looking symbols, ... Any hint on how to do this? thanks in advance for any help here! Eric P.S.: I already posted a similar question a few days ago, so forgive me for this repetition... -- ==================================================================== Eric Emsellem emsellem@... Centre de Recherche Astrophysique de Lyon 9 av. Charles-Andre tel: +33 (0)4 78 86 83 84 69561 Saint-Genis Laval Cedex fax: +33 (0)4 78 86 83 86 France http://www-obs.univ-lyon1.fr/eric.emsellem ==================================================================== ```
 Re: [Matplotlib-users] problem with new symbols From: Eric Emsellem - 2006-05-19 15:20:11 ``` great!

a quick one then: how would you then do to have a marker symbols where some part of the polygon is not attached to the rest (a vertical line plus an ellipse for example). I could do that using two different markers and plotting them one after the other, but is there a simpler way?

thanks
Eric

John Hunter wrote:
"Eric" == Eric Emsellem <emsellem@...> writes:
Eric> Hi again, I am trying to see if I could produce a scatter     Eric> plot (using "scatter" or "plot") but using NEW symbols (so     Eric> not already available in the list provided). I would like to     Eric> design new symbols (in some way which is to be defined) so     Eric> that scatter and/or plot would be able to use them.     Eric> Examples: horizontal or vertical or even rotated ellipses,     Eric> icon sketched galaxy-looking symbols, ...      Eric> Any hint on how to do this?      Eric> thanks in advance for any help here!      Eric> Eric P.S.: I already posted a similar question a few days     Eric> ago, so forgive me for this repetition...  persistence wins the day!  I added an option to scatter to support custom markers.  You pass in a list if x,y vertices for the polygon you want to use as the marker.  I haven't quite worked out the scaling yet, so for now use scale arguments that look right and understand that this may change when we get the scaling issue cleaned up.  I added an example to svn revision 2402 examples/scatter_custom_symbol.py.  Here it is, using an ellipse    from pylab import figure, nx, show    # unit area ellipse   rx, ry = 3., 1.   area = rx * ry * nx.pi   theta = nx.arange(0, 2*nx.pi+0.01, 0.1)   verts = zip(rx/area*nx.cos(theta), ry/area*nx.sin(theta))    x,y,s,c = nx.rand(4, 30)   s*= 10**2.      fig = figure()   ax = fig.add_subplot(111)   ax.scatter(x,y,s,c,marker=None,verts =verts)    show()  One thing we can do to make this more user friendly is to add new symbols to the scatter symbol table, eg  'wellipse' : a wide ellipse 'tellipse' : a tall ellipse  and map names to sequences of vertices.  So as you create the custom symbols you want to use, send them to me and I'll add them to the defaults, where appropriate.  Cheers, JDH

--  ==================================================================== Eric Emsellem                             emsellem@...                            Centre de Recherche Astrophysique de Lyon 9 av. Charles-Andre                        tel: +33 (0)4 78 86 83 84 69561 Saint-Genis Laval Cedex              fax: +33 (0)4 78 86 83 86 France                    http://www-obs.univ-lyon1.fr/eric.emsellem; ====================================================================
```
 Re: [Matplotlib-users] problem with new symbols From: John Hunter - 2006-05-19 15:43:41 ```>>>>> "Eric" == Eric Emsellem writes: Eric> great! a quick one then: how would you then do to have a Eric> marker symbols where some part of the polygon is not Eric> attached to the rest (a vertical line plus an ellipse for Eric> example). I could do that using two different markers and Eric> plotting them one after the other, but is there a simpler Eric> way? thanks Eric Just use the brute force approach for now, and when I get some time I'll look into generalizing this for general paths. JDH ```
 Re: [Matplotlib-users] problem with new symbols From: Nicolas Gruel - 2006-05-19 16:31:41 ```Hi, it seems that there are a bug in numerix with numarray (it's working fine w= ith=20 numpy) and the random array package. \$ python scatter_custom_symbol.py Traceback (most recent call last): File "scatter_custom_symbol.py", line 9, in ? x,y,s,c =3D nx.rand(4, 30) AttributeError: 'module' object has no attribute 'rand' humufr@...:~/tmp/Python/SCIPY/matplotlib/matplotlib/examples N. Le Friday 19 Mai 2006 10:10, John Hunter a =E9crit=A0: > >>>>> "Eric" =3D=3D Eric Emsellem writes: > > Eric> Hi again, I am trying to see if I could produce a scatter > Eric> plot (using "scatter" or "plot") but using NEW symbols (so > Eric> not already available in the list provided). I would like to > Eric> design new symbols (in some way which is to be defined) so > Eric> that scatter and/or plot would be able to use them. > Eric> Examples: horizontal or vertical or even rotated ellipses, > Eric> icon sketched galaxy-looking symbols, ... > > Eric> Any hint on how to do this? > > Eric> thanks in advance for any help here! > > Eric> Eric P.S.: I already posted a similar question a few days > Eric> ago, so forgive me for this repetition... > > persistence wins the day! > > I added an option to scatter to support custom markers. You pass in a > list if x,y vertices for the polygon you want to use as the marker. > > I haven't quite worked out the scaling yet, so for now use scale > arguments that look right and understand that this may change when we > get the scaling issue cleaned up. > > I added an example to svn revision 2402 > examples/scatter_custom_symbol.py. Here it is, using an ellipse > > from pylab import figure, nx, show > > # unit area ellipse > rx, ry =3D 3., 1. > area =3D rx * ry * nx.pi > theta =3D nx.arange(0, 2*nx.pi+0.01, 0.1) > verts =3D zip(rx/area*nx.cos(theta), ry/area*nx.sin(theta)) > > x,y,s,c =3D nx.rand(4, 30) > s*=3D 10**2. > > > fig =3D figure() > ax =3D fig.add_subplot(111) > ax.scatter(x,y,s,c,marker=3DNone,verts =3Dverts) > > show() > > One thing we can do to make this more user friendly is to add new > symbols to the scatter symbol table, eg > > 'wellipse' : a wide ellipse > 'tellipse' : a tall ellipse > > and map names to sequences of vertices. So as you create the custom > symbols you want to use, send them to me and I'll add them to the > defaults, where appropriate. > > Cheers, > JDH > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ```
 Re: [Matplotlib-users] problem with new symbols From: John Hunter - 2006-05-19 16:35:24 ```>>>>> "Nicolas" == Nicolas Gruel writes: Nicolas> Hi, it seems that there are a bug in numerix with Nicolas> numarray (it's working fine with numpy) and the random Nicolas> array package. Nicolas> \$ python scatter_custom_symbol.py Traceback (most recent Nicolas> call last): File "scatter_custom_symbol.py", line 9, in ? Nicolas> x,y,s,c = nx.rand(4, 30) AttributeError: 'module' object Nicolas> has no attribute 'rand' Nicolas> humufr@...:~/tmp/Python/SCIPY/matplotlib/matplotlib/examples Fixed in svn -- thanks. JDH ```
 Re: [Matplotlib-users] problem with new symbols From: Eric Emsellem - 2006-05-19 16:47:34 ``` I think there is a bug with the new verts because it cannot then use "scales" with len(scales)=1.:

/usr/lib/python2.4/site-packages/matplotlib/axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, faceted, verts, **kwargs)
3072             #scales = sqrt(scales * self.figure.dpi.get() / 72.)
3073             if len(scales)==1:
-> 3074                 verts = [s[0]*verts]

Eric

John Hunter wrote:
"Eric" == Eric Emsellem <emsellem@...> writes:
Eric> Hi again, I am trying to see if I could produce a scatter     Eric> plot (using "scatter" or "plot") but using NEW symbols (so     Eric> not already available in the list provided). I would like to     Eric> design new symbols (in some way which is to be defined) so     Eric> that scatter and/or plot would be able to use them.     Eric> Examples: horizontal or vertical or even rotated ellipses,     Eric> icon sketched galaxy-looking symbols, ...      Eric> Any hint on how to do this?      Eric> thanks in advance for any help here!      Eric> Eric P.S.: I already posted a similar question a few days     Eric> ago, so forgive me for this repetition...  persistence wins the day!  I added an option to scatter to support custom markers.  You pass in a list if x,y vertices for the polygon you want to use as the marker.  I haven't quite worked out the scaling yet, so for now use scale arguments that look right and understand that this may change when we get the scaling issue cleaned up.  I added an example to svn revision 2402 examples/scatter_custom_symbol.py.  Here it is, using an ellipse    from pylab import figure, nx, show    # unit area ellipse   rx, ry = 3., 1.   area = rx * ry * nx.pi   theta = nx.arange(0, 2*nx.pi+0.01, 0.1)   verts = zip(rx/area*nx.cos(theta), ry/area*nx.sin(theta))    x,y,s,c = nx.rand(4, 30)   s*= 10**2.      fig = figure()   ax = fig.add_subplot(111)   ax.scatter(x,y,s,c,marker=None,verts =verts)    show()  One thing we can do to make this more user friendly is to add new symbols to the scatter symbol table, eg  'wellipse' : a wide ellipse 'tellipse' : a tall ellipse  and map names to sequences of vertices.  So as you create the custom symbols you want to use, send them to me and I'll add them to the defaults, where appropriate.  Cheers, JDH

--  ==================================================================== Eric Emsellem                             emsellem@...                            Centre de Recherche Astrophysique de Lyon 9 av. Charles-Andre                        tel: +33 (0)4 78 86 83 84 69561 Saint-Genis Laval Cedex              fax: +33 (0)4 78 86 83 86 France                    http://www-obs.univ-lyon1.fr/eric.emsellem; ====================================================================
```
 Re: [Matplotlib-users] problem with new symbols From: John Hunter - 2006-05-19 16:51:41 ```>>>>> "Eric" == Eric Emsellem writes: Eric> I think there is a bug with the new verts because it Eric> cannot then use "scales" with len(scales)=1.: Eric> /usr/lib/python2.4/site-packages/matplotlib/axes.py in Eric> scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, Eric> alpha, linewidths, faceted, verts, **kwargs) 3072 #scales = Eric> sqrt(scales * self.figure.dpi.get() / 72.) 3073 if Eric> len(scales)==1: -> 3074 verts = [s[0]*verts] Fixed in svn 2404 -- thanks. JDH ```
 Re: [Matplotlib-users] problem with new symbols From: John Hunter - 2006-05-19 14:16:02 ```>>>>> "Eric" == Eric Emsellem writes: Eric> Hi again, I am trying to see if I could produce a scatter Eric> plot (using "scatter" or "plot") but using NEW symbols (so Eric> not already available in the list provided). I would like to Eric> design new symbols (in some way which is to be defined) so Eric> that scatter and/or plot would be able to use them. Eric> Examples: horizontal or vertical or even rotated ellipses, Eric> icon sketched galaxy-looking symbols, ... Eric> Any hint on how to do this? Eric> thanks in advance for any help here! Eric> Eric P.S.: I already posted a similar question a few days Eric> ago, so forgive me for this repetition... persistence wins the day! I added an option to scatter to support custom markers. You pass in a list if x,y vertices for the polygon you want to use as the marker. I haven't quite worked out the scaling yet, so for now use scale arguments that look right and understand that this may change when we get the scaling issue cleaned up. I added an example to svn revision 2402 examples/scatter_custom_symbol.py. Here it is, using an ellipse from pylab import figure, nx, show # unit area ellipse rx, ry = 3., 1. area = rx * ry * nx.pi theta = nx.arange(0, 2*nx.pi+0.01, 0.1) verts = zip(rx/area*nx.cos(theta), ry/area*nx.sin(theta)) x,y,s,c = nx.rand(4, 30) s*= 10**2. fig = figure() ax = fig.add_subplot(111) ax.scatter(x,y,s,c,marker=None,verts =verts) show() One thing we can do to make this more user friendly is to add new symbols to the scatter symbol table, eg 'wellipse' : a wide ellipse 'tellipse' : a tall ellipse and map names to sequences of vertices. So as you create the custom symbols you want to use, send them to me and I'll add them to the defaults, where appropriate. Cheers, JDH ```