Re: [matplotlib-devel] custom symbol patch

2006-10-13 Thread Manuel Metz
Hallo,

sorry to bother you again. I recognized that I introduced an error in my
last patch :-(

sym = None
starlike = False

# to be API compatible
if sym is None and not (verts is None):
   ^^^

This, of cause, makes no sense. The correct line reads:

   if marker is None and not (verts is None):
  ^^

I've attached a patch... I apologize again ...

Manuel

Manuel Metz wrote:
> John Hunter wrote:
> "Manuel" == Manuel Metz <[EMAIL PROTECTED]> writes:
>>> Manuel> There is a subtle but essential difference  ;-)  : for i in
>>> Manuel> xrange(1,len(r), 2 ) ^^^ , i.e. every second value gets
>>> Manuel> rescaled. But there is probably a more "pythonic" way to
>>> Manuel> do that:
>>>
>>> Manuel> r = 1.0/math.sqrt(math.pi) # unit area r = asarray(
>>> Manuel> [r,0.5*r]*self.numsides )
>>>
>>> Manuel> I'm not aware of a better way to do this with numerix  :-(
>>>
>>> Oops, sorry I missed that.  I think what you want is then
>>>
>>> scale = 0.5/math.sqrt(math.pi)
>>> r = scale*ones(self.numsides*2)
>>> r[1::2] *= 0.5
>>>
> 
> I've fixed that - and I've learned something !
> 
>>> OK, if I could make a few more suggestions (I feel like a customer at
>>> a restaurant where every time the waiter brings me a cup of coffee I
>>> ask "just one more thing"...)
>>>
>>> +old_ymin,old_ymax = self.get_ylim()
>>>
>>> The matplotlib style guidelines are
>>>
>>>   UpperCase : classes
>>>   lower_underscore  : functions and methods
>>>   lower or lowerUpper : variables or attributes
>>>
>>> For shortish variable names, I prefer
>>>
>>> oldymin, oldymax = self.get_ylim()
> 
> Ah - there are three lines that I touched for only one reason: the line
> indention was done with a "tab" instead of "spaces". When I recognised
> this in my text editor, I changed it to space-indention. That's the only
> reason for these patched lines.
> 
>>> +if isinstance(marker, str) or isinstance(marker, unicode):
>>> +# the standard way to define symbols using a string
> character
>>> +sym = syms.get(marker)
>>>
>>> +if isinstance(marker, tuple) or isinstance(marker, list):
>>> +# accept marker to be:
>>> +#(numsides, style, [angle])
>>>
>>> +if isinstance(marker[0], int) or isinstance(marker[0],
> long):
>>> +# (numsides, style, [angle])
>>>
>>> Here you should use "duck typing" not "type checking" (google "duck
>>> typing").  matplotlib.cbook provides several duck typing functions, eg
>>> is_stringlike, iterable and is_numlike.  Take a look at is_numlike
>>>
>>> def is_numlike(obj):
>>> try: obj+1
>>> except TypeError: return False
>>> else: return True
>>>
>>> Ie, if it acts like a number (you can add one to it) then we'll treat
>>> it as a number.  This allows users to provide other integer like
>>> classes which are not ints or longs.  Everytime you use isinstance,
>>> take a 2nd look.  There may be a better way.
>>>
>>> I'll await your updated patch  :-)
> 
> I've fixed that too - and learned even more  ;-)  Thanks !
> 
> Patch against latest revision is attached.
> 
> Manuel
> 
> 
> 
> 
> 
> Index: axes.py
> ===
> --- axes.py   (revision 2811)
> +++ axes.py   (working copy)
> @@ -14,8 +14,9 @@
>  from artist import Artist, setp
>  from axis import XAxis, YAxis
>  from cbook import iterable, is_string_like, flatten, enumerate, \
> - allequal, dict_delall, popd, popall, silent_list
> -from collections import RegularPolyCollection, PolyCollection, 
> LineCollection, QuadMesh
> + allequal, dict_delall, popd, popall, silent_list, is_numlike
> +from collections import RegularPolyCollection, PolyCollection, 
> LineCollection, QuadMesh, \
> + StarPolygonCollection
>  from colors import colorConverter, normalize, Colormap, \
>  LinearSegmentedColormap, looks_like_color, is_color_like
>  import cm
> @@ -1211,7 +1212,7 @@
>  if xmax is None and hasattr(xmin,'__len__'):
>  xmin,xmax = xmin
>  
> - old_xmin,old_xmax = self.get_xlim()
> +old_xmin,old_xmax = self.get_xlim()
>  if xmin is None: xmin = old_xmin
>  if xmax is None: xmax = old_xmax
>  
> @@ -1223,7 +1224,7 @@
>  xmin -= 1e-38
>  xmax += 1e-38
>  
> - self.viewLim.intervalx().set_bounds(xmin, xmax)
> +self.viewLim.intervalx().set_bounds(xmin, xmax)
>  if emit: self._send_xlim_event()
>  return xmin, xmax
>  
> @@ -1324,7 +1325,7 @@
>  if ymax is None and hasattr(ymin,'__len__'):
>  ymin,ymax = ymin
>  
> - old_ymin,old_ymax = self.get_ylim()
> +old_ymin,old_ymax = self.get_ylim()
>  if ymin is None: ymin = old_ymin
>  if ymax is None: y

Re: [matplotlib-devel] custom symbol patch

2006-10-13 Thread John Hunter
> "Manuel" == Manuel Metz <[EMAIL PROTECTED]> writes:

Manuel> I've attached a patch... I apologize again ...

No problem - -I just committed this change.

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=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Are you planning to make another release once NumPy 1.0 is out?

2006-10-13 Thread Travis Oliphant

Hi folks,

I'm contemplating a useful change to ufuncs to allow them to take 
keyword arguments in the future (I have at least two keyword arguments 
in mind).  Unfortunately, this requires a change to the way some 
functions are called which would mean a bump in the C-API version.

This bump is largest issue for users who download latest numpy and then 
have problems with their current Matplotlib. 

How to members on this list feel about a NumPy C-API version number 
increase for 1.0 final (1.0rc3 first which would become 1.0final a few 
days later).

-Travis


-
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=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Are you planning to make another release once NumPy 1.0 is out?

2006-10-13 Thread John Hunter
> "Travis" == Travis Oliphant <[EMAIL PROTECTED]> writes:

Travis> How to members on this list feel about a NumPy C-API
Travis> version number increase for 1.0 final (1.0rc3 first which
Travis> would become 1.0final a few days later).

We'll tolerate whatever pain is necessary to achieve the one true
numpy final.

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=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel