Re: [matplotlib-devel] [Fwd: axes.py scatter doc-bug]

2008-03-20 Thread Manuel Metz

Michael Droettboom wrote:
Sorry -- I see it now.  Disregard my earlier message.  It is now fixed 
in SVN r5004.


Hi Michael,

thanks. Unfortunately there is now still some duplicity of text in the 
docs. I've attached a patch (against svn 5008) that fixes this and also 
adds the doc for '+' and 'x' markers which is missing.


Manuel


Manuel Metz wrote:
Happend with your commit from version 4979 -> 4989. Who's going to fix 
that ? Whom can I directly contact ?


 Original Message 
Subject: [matplotlib-devel] axes.py scatter doc-bug
Date: Wed, 12 Mar 2008 12:30:12 +0100
From: Manuel Metz <[EMAIL PROTECTED]>
To: matplotlib-devel@lists.sourceforge.net
CC: John Hunter <[EMAIL PROTECTED]>

Hi,
the doc-string of the axes scatter method is buggy. Somehow the
svn-conflict messages got committed to the repository:
I mean this

<<< .working
[...]
===
[...]
 >>> .merge-right.r4987

... stuff)

Manuel



Index: axes.py
===
--- axes.py	(revision 5008)
+++ axes.py	(working copy)
@@ -4172,6 +4172,8 @@
 'p' : pentagram
 'h' : hexagon
 '8' : octagon
+'+' : plus
+'x' : cross
 
 The marker can also be a tuple (numsides, style, angle), which will
 create a custom, regular symbol.
@@ -4188,18 +4190,6 @@
 Finally, marker can be (verts, 0), verts is a sequence of (x,y)
 vertices for a custom scatter symbol.
 
-numsides is the number of sides
-
-style is the style of the regular symbol:
-  0 : a regular polygon
-  1 : a star-like symbol
-  2 : an asterisk
-
-angle is the angle of rotation of the symbol
-
-Finally, marker can be (verts, 0), verts is a sequence of (x,y)
-vertices for a custom scatter symbol.
-
 s is a size argument in points squared.
 
 Any or all of x, y, s, and c may be masked arrays, in which
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] TKinter : 'module' object has no attribute 'tkinit'

2008-03-20 Thread fiacre
I'm running Idle via X forwarding to my Windows desktop (running Cygwin).

I've installed tcl/tk and python with Tkinter as a backend.

When I call pylab.show(),  I always get the error :

 >>> pylab.show()
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
return self.func(*args)
  File 
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", 
line 151, in resize
self.show()
  File 
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", 
line 155, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
  File "/usr/lib/python2.5/site-packages/matplotlib/backends/tkagg.py", 
line 14, in blit
_tkagg.tkinit(id(tk), 0)
AttributeError: 'module' object has no attribute 'tkinit'


And an empty matplotlib window opens on my desktop.


Should I try gtk as a backend???

TIA

-- Andrew

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] linestyles patch - please review

2008-03-20 Thread Manuel Metz

Hello,

I have attached a patch that addresses the following:

  plot accepts the linestyles arguments '-','--','-.',':' [+ some more]
and the Collection class accepts the
  linestyle arguments 'solid','dashed','dashdot','dotted'.

This patch allows to use both notations. A test script is attached too. 
So its possible to use

  plot(x,y, linestyle='--') # old (preferred) style
  plot(x,y, linestyle='dashed') # now also possible
and also
  contour(Z, linestyles='dotted') # old style
  contour(Z, linestyles=':')  # now also possible
The latter case is probably more useful than the first, but both work.

Any comments ?

Manuel
Index: cbook.py
===
--- cbook.py	(revision 5009)
+++ cbook.py	(working copy)
@@ -1068,6 +1068,16 @@
 
 return result
 
+
+# a dict to cross-map linestyle arguments
+_linestyles = [('-', 'solid'),
+('--', 'dashed'),
+('-.', 'dashdot'),
+(':',  'dotted')]
+
+ls_mapper = dict(_linestyles)
+ls_mapper.update([(ls[1], ls[0]) for ls in _linestyles])
+
 if __name__=='__main__':
 assert( allequal([1,1,1]) )
 assert(not  allequal([1,1,0]) )
Index: collections.py
===
--- collections.py	(revision 5009)
+++ collections.py	(working copy)
@@ -228,14 +228,25 @@
 ACCEPTS: ['solid' | 'dashed', 'dashdot', 'dotted' |  (offset, on-off-dash-seq) ]
 """
 try:
+dashd = backend_bases.GraphicsContextBase.dashd
 if cbook.is_string_like(ls):
-dashes = [backend_bases.GraphicsContextBase.dashd[ls]]
+if dashd.has_key(ls):
+dashes = [dashd[ls]]
+elif cbook.ls_mapper.has_key(ls):
+dashes = [dashd[cbook.ls_mapper[ls]]]
+else:
+raise ValueError()
 elif cbook.iterable(ls):
 try:
 dashes = []
 for x in ls:
 if cbook.is_string_like(x):
-dashes.append(backend_bases.GraphicsContextBase.dashd[ls])
+if dashd.has_key(x):
+dashes.append(dashd[x])
+elif cbook.ls_mapper.has_key(x):
+dashes.append(dashd[cbook.ls_mapper[x]])
+else:
+raise ValueError()
 elif cbook.iterator(x) and len(x) == 2:
 dashes.append(x)
 else:
Index: lines.py
===
--- lines.py	(revision 5009)
+++ lines.py	(working copy)
@@ -11,7 +11,7 @@
 from matplotlib import verbose
 import artist
 from artist import Artist
-from cbook import iterable, is_string_like, is_numlike
+from cbook import iterable, is_string_like, is_numlike, ls_mapper
 from colors import colorConverter
 from path import Path
 from transforms import Affine2D, Bbox, TransformedPath
@@ -598,7 +598,10 @@
 ACCEPTS: [ '-' | '--' | '-.' | ':' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post' | 'None' | ' ' | '' ]
 """
 if linestyle not in self._lineStyles:
-verbose.report('Unrecognized line style %s, %s' %
+if ls_mapper.has_key(linestyle):
+linestyle = ls_mapper[linestyle]
+else:
+verbose.report('Unrecognized line style %s, %s' %
 (linestyle, type(linestyle)))
 if linestyle in [' ','']:
 linestyle = 'None'
import pylab

x = pylab.npy.arange(5)
pylab.plot(x,x, linestyle='-')
pylab.plot(x,x**2, linestyle='dashedu')

# makes not much sens but works in principle ;-)
pylab.scatter(x,pylab.npy.sqrt(x), s=150 ,linestyle='dashed')
pylab.scatter(x,0.5*pylab.npy.sqrt(x), s=150 ,linestyle=':')

pylab.scatter(x,0.25*pylab.npy.sqrt(x), s=150 ,linestyle=['-','--','-.',':','-'])


delta = 0.025
x = pylab.npy.arange(-3.0, 3.0, delta)
y = pylab.npy.arange(-2.0, 2.0, delta)
X, Y = pylab.npy.meshgrid(x, y)
Z1 = pylab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = pylab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)

linestyles = ['solid', 'dashed', 'dashdot', 'dotted',
'-','--','-.',':']

pylab.figure()
CS = pylab.contour(X, Y, Z, 8, linestyles=linestyles)

pylab.show()
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel