[Matplotlib-users] dates fail after upgrade
I upgraded to matplotlib-0.87.4 Now I receive an error like the following every time I try to use matplotlib.dates. The following error messages were generated when I tried to run matplotlib-0.87.4/examples/date_demo1.pyAny Idea on how I can get dates working again?(I am running the 2.6.17.6 kernel on a 64-bit linux system)Example:matplotlib-0.87.4/examples]$ python date_demo1.pyTraceback (most recent call last): File "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtk.py", line 284, in expose_event self._render_figure(self._pixmap, w, h) File "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py", line 73, in _render_figure FigureCanvasAgg.draw(self) File "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py", line 391, in draw self.figure.draw(renderer) File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line 532, in draw for a in self.axes: a.draw(renderer) File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line 1045, in draw a.draw(renderer) File "/usr/lib64/python2.4/site-packages/matplotlib/axis.py", line 548, in draw majorLabels = [self.major.formatter(val, i) for i, val in enumerate(majorLocs)] File "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 247, in __call__ dt = num2date(x, self.tz) File "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 205, in num2date if not iterable(x): return _from_ordinalf(x, tz) File "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 156, in _from_ordinalf hour, remainder = divmod(24*remainder, 1)ValueError: need more than 0 values to unpackTraceback (most recent call last):Richard- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting in West Longitude
Jeff Sadino wrote: > Hello All, > > I am trying to map the surface of TItan for a summer internship project at > NASA. I would like to use matplotlib to plot, but I need to plot in West > Longitude, where the left edge of the graph starts at 360 and the right edge > ends at 0. Does anyone know how to do this? > > Thanks much, > Jeff > > > Jeff: Using the basemap toolkit, from matplotlib.toolkits.basemap import Basemap # setup cylindrical equidistant map projection (global domain). # resolution=None means don't bother with earth coastlines and political boundaries. m = Basemap(llcrnrlon=0.,llcrnrlat=-90,urcrnrlon=360.,urcrnrlat=90.,resolution=None,projection='cyl') # use plot, contour, imshow, pcolor .. methods to plot the data here # draw parallels delat = 30. circles = arange(0.,90.+delat,delat).tolist()+\ arange(-delat,-90.-delat,-delat).tolist() m.drawparallels(circles,labels=[1,0,0,1]) # draw meridians delon = 60. meridians = arange(-180,180,delon) m.drawmeridians(meridians,labels=[1,0,0,1]) title('Cylindrical Equidistant') show() There are lots of examples in the source distribution, and a short tutorial is here http://www.scipy.org/Cookbook/Matplotlib/Maps HTH, -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : [EMAIL PROTECTED] 325 BroadwayOffice : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Pixel placement of text
Hey that's great. Thanks Jouni. There may be a better way, but this is at least a lot easier to figure out than the code in QuiverKey! You can even throw all the magic into one function like this: def const_offset(x,y): ax = gca() ll1 = ax.transData.get_bbox1().ll() ur1 = ax.transData.get_bbox1().ur() ll2 = ax.transData.get_bbox2().ll() ur2 = ax.transData.get_bbox2().ur() scale_x = (ur2.x()-ll2.x())/(ur1.x()-ll1.x()) scale_y = (ur2.y()-ll2.y())/(ur1.y()-ll1.y()) offset = Point(Value(x), Value(y)) trans = Affine(scale_x, zero(), zero(), scale_y, ll2.x()-scale_x*ll1.x() + offset.x(), ll2.y()-scale_y*ll1.y() + offset.y()) return trans And then just add a transform=const_offset(x,y) parameter wherever you want one. Great. And it works for things besides text too. #!/usr/bin/env python import matplotlib from matplotlib.transforms import Value, zero, Affine, Point from pylab import figure, show, gca def const_offset(x,y): ax = gca() ll1 = ax.transData.get_bbox1().ll() ur1 = ax.transData.get_bbox1().ur() ll2 = ax.transData.get_bbox2().ll() ur2 = ax.transData.get_bbox2().ur() scale_x = (ur2.x()-ll2.x())/(ur1.x()-ll1.x()) scale_y = (ur2.y()-ll2.y())/(ur1.y()-ll1.y()) offset = Point(Value(x), Value(y)) trans = Affine(scale_x, zero(), zero(), scale_y, ll2.x()-scale_x*ll1.x() + offset.x(), ll2.y()-scale_y*ll1.y() + offset.y()) return trans x = (3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3) y = (2,7,1,8,2,8,1,8,2,8,4,5,9,0,4,5) fig=figure() ax=fig.add_subplot(111) ax.plot(x,y,'.') for a,b in zip(x,y): ax.text(a, b, '(%d,%d)'%(a,b), transform=const_offset(20,0)) ax.plot(x,y, 'gv',transform=const_offset(0,-10)) ax.plot(x,y, 'm^',transform=const_offset(0, 10)) show() - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] installation problem
OK, I was able to install with 0.87.4 (still no tkagg, however). This is still with the tar.gz version of numpy-1.0b I will try to re-install numpy from the rpms to see if that makes a difference. -sen BTW You guys are great! I love the way you got to my questions so fast. Reminds me of the old redhat days (e.g. when Eric Troan, Donnie Barnes, Marc Ewing, etc. would answer questions on the mailing lists). I hope you can keep it up. On Fri, 28 Jul 2006, Charlie Moad wrote: > It looks like Travis committed a numpy 1.0 compatibility fix on July > 7th. It includes the header which addresses your error. You will > have to use >=matplotlib-0.87.4 if you want to use the latest numpy. > > - Charlie > - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] installation problem
I got the numpy src.rpm from www.numpy.org On Fri, 28 Jul 2006, Asheesh Laroia wrote: > On Thu, 27 Jul 2006, [EMAIL PROTECTED] wrote: > >> All of the necessary addons- scipy, numarray, Numeric, gtk, etc have been >> added. > > Well, something in the build system thinks something is missing. So let us > know *exactly* what RPMs you installed (with URLs preferably), or where you > got the source packages for those things and how you installed them. > > -- Asheesh. > > -- --- | Sheldon E. Newhouse|e-mail: [EMAIL PROTECTED] | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684| | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562| --- - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] installation problem
On 7/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > OK, I was able to install with 0.87.4 (still no tkagg, however). What's the error you are getting with tk? Do you have the dev packages installed? > This is still with the tar.gz version of numpy-1.0b > > I will try to re-install numpy from the rpms to see if that makes a > difference. > -sen > > BTW You guys are great! I love the way you got to my questions so > fast. Reminds me of the old redhat days (e.g. when Eric Troan, Donnie > Barnes, Marc Ewing, etc. would answer questions on the mailing lists). Thanks! - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] installation problem
Here is the output of an attempt to install 0.87.4 with tkagg. It installs fine without it. Any ideas will be appreciated. TIA, -sen compile options: '-I/usr/lib/python2.4/site-packages/numpy/core/include -I/usr/local/include -I/usr/include -I. -I/usr/local/include -I/usr/include -I. -I/ usr/include/pygtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/inc lude/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/i nclude/python2.4 -c' extra options: '-DSCIPY=1' gcc: src/_ns_backend_gdk.c gcc -pthread -shared build/temp.linux-i686-2.4/src/_ns_backend_gdk.o -L/usr/local/lib -L/usr/lib -L/usr/local/lib -L/usr/lib -lgobject-2.0 -lglib-2.0 -lgtk -x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -o build/lib.linu x-i686-2.4/matplotlib/backends/_ns_backend_gdk.so building 'matplotlib.backends._tkagg' extension C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-un wind-tables -D_GNU_SOURCE -fPIC -fPIC compile options: '-I/usr/include -I/usr/include -I/usr/local/include -I/usr/include -I. -Isrc -Iswig -Iagg23/include -I. -I/usr/local/include -I/usr/includ e -I. -I/usr/include/freetype2 -I/usr/include/freetype2 -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -Isrc/freetype2 -Iswig/freety pe2 -Iagg23/include/freetype2 -I./freetype2 -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -I/usr/include/python2.4 -c' gcc: src/_tkagg.cpp src/_tkagg.cpp:28:18: error: tk.h: No such file or directory src/_tkagg.cpp:36: error: ISO C++ forbids declaration of âTcl_Interpâ with no type src/_tkagg.cpp:36: error: expected â;â before â*â token src/_tkagg.cpp:40: error: âClientDataâ was not declared in this scope src/_tkagg.cpp:40: error: âTcl_Interpâ was not declared in this scope src/_tkagg.cpp:40: error: âinterpâ was not declared in this scope src/_tkagg.cpp:41: error: expected primary-expression before âintâ src/_tkagg.cpp:41: error: expected primary-expression before âcharâ src/_tkagg.cpp:41: error: initializer expression list treated as compound expression src/_tkagg.cpp:42: error: expected â,â or â;â before â{â token src/_tkagg.cpp: In function âPyObject* _tkinit(PyObject*, PyObject*)â: src/_tkagg.cpp:174: error: âTcl_Interpâ was not declared in this scope src/_tkagg.cpp:174: error: âinterpâ was not declared in this scope src/_tkagg.cpp:183: error: expected primary-expression before â)â token src/_tkagg.cpp:183: error: expected `;' before âargâ src/_tkagg.cpp:188: error: âstruct TkappObjectâ has no member named âinterpâ src/_tkagg.cpp:194: error: âTcl_CmdProcâ was not declared in this scope src/_tkagg.cpp:194: error: expected primary-expression before â)â token src/_tkagg.cpp:195: error: âClientDataâ was not declared in this scope src/_tkagg.cpp:195: error: âTcl_CmdDeleteProcâ was not declared in this scope src/_tkagg.cpp:195: error: expected primary-expression before â)â token src/_tkagg.cpp:195: error: âTcl_CreateCommandâ was not declared in this scope src/_tkagg.cpp:28:18: error: tk.h: No such file or directory src/_tkagg.cpp:36: error: ISO C++ forbids declaration of âTcl_Interpâ with no type src/_tkagg.cpp:36: error: expected â;â before â*â token src/_tkagg.cpp:40: error: âClientDataâ was not declared in this scope src/_tkagg.cpp:40: error: âTcl_Interpâ was not declared in this scope src/_tkagg.cpp:40: error: âinterpâ was not declared in this scope src/_tkagg.cpp:41: error: expected primary-expression before âintâ src/_tkagg.cpp:41: error: expected primary-expression before âcharâ src/_tkagg.cpp:41: error: initializer expression list treated as compound expression src/_tkagg.cpp:42: error: expected â,â or â;â before â{â token src/_tkagg.cpp: In function âPyObject* _tkinit(PyObject*, PyObject*)â: src/_tkagg.cpp:174: error: âTcl_Interpâ was not declared in this scope src/_tkagg.cpp:174: error: âinterpâ was not declared in this scope src/_tkagg.cpp:183: error: expected primary-expression before â)â token src/_tkagg.cpp:183: error: expected `;' before âargâ src/_tkagg.cpp:194: error: âTcl_CmdProcâ was not declared in this scope src/_tkagg.cpp:194: error: expected primary-expression before â)â token src/_tkagg.cpp:195: error: âClientDataâ was not declared in this scope src/_tkagg.cpp:195: error: âTcl_CmdDeleteProcâ was not declared in this scope src/_tkagg.cpp:195: error: expected primary-expression before â)â token src/_tkagg.cpp:195: error: âTcl_CreateCommandâ was not declared in this scope error: Command "gcc -pthread -fno-strict-al
Re: [Matplotlib-users] installation problem
It can't find tk.h so it looks like you need to install the tk dev packages. On 7/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Here is the output of an attempt to install 0.87.4 with tkagg. > > It installs fine without it. > > > Any ideas will be appreciated. > > TIA, > -sen > > compile options: > '-I/usr/lib/python2.4/site-packages/numpy/core/include > -I/usr/local/include -I/usr/include -I. -I/usr/local/include > -I/usr/include -I. -I/ > usr/include/pygtk-2.0 -I/usr/include/glib-2.0 > -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 > -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/inc > lude/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 > -I/usr/include/freetype2/config -I/usr/include/glib-2.0 > -I/usr/lib/glib-2.0/include -I/usr/i > nclude/python2.4 -c' > extra options: '-DSCIPY=1' > gcc: src/_ns_backend_gdk.c > gcc -pthread -shared build/temp.linux-i686-2.4/src/_ns_backend_gdk.o > -L/usr/local/lib -L/usr/lib -L/usr/local/lib -L/usr/lib -lgobject-2.0 > -lglib-2.0 -lgtk > -x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 > -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 > -o build/lib.linu > x-i686-2.4/matplotlib/backends/_ns_backend_gdk.so > building 'matplotlib.backends._tkagg' extension > C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 > -fasynchronous-un > wind-tables -D_GNU_SOURCE -fPIC -fPIC > > compile options: '-I/usr/include -I/usr/include -I/usr/local/include > -I/usr/include -I. -Isrc -Iswig -Iagg23/include > -I. -I/usr/local/include -I/usr/includ > e -I. -I/usr/include/freetype2 -I/usr/include/freetype2 > -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 > -Isrc/freetype2 -Iswig/freety > pe2 -Iagg23/include/freetype2 -I./freetype2 > -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 > -I/usr/include/python2.4 -c' > gcc: src/_tkagg.cpp > src/_tkagg.cpp:28:18: error: tk.h: No such file or directory > src/_tkagg.cpp:36: error: ISO C++ forbids declaration of 'Tcl_Interp' > with no type > src/_tkagg.cpp:36: error: expected ';' before '*' token > src/_tkagg.cpp:40: error: 'ClientData' was not declared in this scope > src/_tkagg.cpp:40: error: 'Tcl_Interp' was not declared in this scope > src/_tkagg.cpp:40: error: 'interp' was not declared in this scope > src/_tkagg.cpp:41: error: expected primary-expression before 'int' > src/_tkagg.cpp:41: error: expected primary-expression before 'char' > src/_tkagg.cpp:41: error: initializer expression list treated as > compound expression > src/_tkagg.cpp:42: error: expected ',' or ';' before '{' token > src/_tkagg.cpp: In function 'PyObject* _tkinit(PyObject*, PyObject*)': > src/_tkagg.cpp:174: error: 'Tcl_Interp' was not declared in this scope > src/_tkagg.cpp:174: error: 'interp' was not declared in this scope > src/_tkagg.cpp:183: error: expected primary-expression before ')' > token > src/_tkagg.cpp:183: error: expected `;' before 'arg' > src/_tkagg.cpp:188: error: 'struct TkappObject' has no member named > 'interp' > src/_tkagg.cpp:194: error: 'Tcl_CmdProc' was not declared in this > scope > src/_tkagg.cpp:194: error: expected primary-expression before ')' > token > src/_tkagg.cpp:195: error: 'ClientData' was not declared in this scope > src/_tkagg.cpp:195: error: 'Tcl_CmdDeleteProc' was not declared in > this scope > src/_tkagg.cpp:195: error: expected primary-expression before ')' > token > src/_tkagg.cpp:195: error: 'Tcl_CreateCommand' was not declared in > this scope > src/_tkagg.cpp:28:18: error: tk.h: No such file or directory > src/_tkagg.cpp:36: error: ISO C++ forbids declaration of 'Tcl_Interp' > with no type > src/_tkagg.cpp:36: error: expected ';' before '*' token > src/_tkagg.cpp:40: error: 'ClientData' was not declared in this scope > src/_tkagg.cpp:40: error: 'Tcl_Interp' was not declared in this scope > src/_tkagg.cpp:40: error: 'interp' was not declared in this scope > src/_tkagg.cpp:41: error: expected primary-expression before 'int' > src/_tkagg.cpp:41: error: expected primary-expression before 'char' > src/_tkagg.cpp:41: error: initializer expression list treated as > compound expression > src/_tkagg.cpp:42: error: expected ',' or ';' before '{' token > src/_tkagg.cpp: In function 'PyObject* _tkinit(PyObject*, PyObject*)': > src/_tkagg.cpp:174: error: 'Tcl_Interp' was not declared in this scope > src/_tkagg.cpp:174: error: 'interp' was not declared in this scope > src/_tkagg.cpp:183: error: expected primary-expression before ')' > token > src/_tkagg.cpp:183: error: expected `;' before 'arg' > src/_tkagg.cpp:194: error: 'Tcl_CmdProc' was not declared in this > scope > src/_tkagg.cpp:194: error: expected primary-expression before ')' > token > src/_tkagg.cpp:195: error: 'ClientData' was not declared in this scope > src/_tkagg.cpp:195: error: 'Tcl_CmdDeleteProc' was not declared in > this scope > src/_tkagg.cpp:195: error: expected primar
Re: [Matplotlib-users] Legend, Axis-Title and umlaut and special characters
Till Wagner <[EMAIL PROTECTED]> writes: > The program should be localized to german, frensh, italian and > spanish, so the names can include some umlauts and special > characters (like ä, ü, ö, ß, ß, é and so on). In my program it works > well, but in the matplotlib-graphs are only squares where the > umlauts should be. Same with the legend. Any help or tips? The font encoding doesn't match the encoding you're using. Using unicode strings, e.g. u"\u00e4" for ä, may work better, assuming of course that the font does have the characters you need and that the backend implements unicode text. Some resources about Unicode in Python are http://www.jorendorff.com/articles/unicode/python.html http://dalchemy.com/opensource/unicodedoc/ -- Jouni - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Pixel placement of text
[I'm Cc:ing people since the mailing list forwarder seems to be working really slowly.] Hi Bill, > You can even throw all the magic into one function like this: > > def const_offset(x,y): [...] > > And then just add a transform=const_offset(x,y) parameter wherever > you want one. This will waste some memory by creating a new transform object every time, which could matter if your plots contain lots of text labels. You can simply create the transformation once and then use it when needed. Here's a better solution adapted from John Hunter's and Eric Firing's posts and putting the transformation magic into a function: #!/usr/bin/env python import matplotlib from matplotlib.transforms import blend_xy_sep_transform, \ identity_transform from pylab import figure, show def offset(ax, x, y): # This makes a shallow copy of ax.transData: # (as of svn 2630, there is copy_bbox_transform_shallow for this purpose) trans = blend_xy_sep_transform(ax.transData, ax.transData) trans.set_offset((x,y), identity_transform()) return trans fig=figure() ax=fig.add_subplot(111) # plot some data x = (3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3) y = (2,7,1,8,2,8,1,8,2,8,4,5,9,0,4,5) ax.plot(x,y,'.') # add labels trans=offset(ax, 10, 5) for a,b in zip(x,y): ax.text(a, b, '(%d,%d)'%(a,b), transform=trans) show() It has the advantage of working with logarithmic plots: try setp(gca(), xscale='log'). It doesn't work with polar plots (and neither does my previous suggestion). Apparently trans.set_offset allows for just this kind of thing: adding a pixel offset to an existing transformation. How about adding a possibility to compose arbitrary transformations as functions? Then we wouldn't have to worry about copying transData, and it would automatically work for polar plots and whatever somebody will come up with in the future, just by saying something like trans = compose(ax.transData, translation_transform(Value(10), Value(5))) text(x, y, 'foobar', transformation=trans) -- Jouni - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dates fail after upgrade
On Friday 28 July 2006 17:19, Richard Ruth wrote: > I upgraded to matplotlib-0.87.4 Now I receive an error like the following > every time I try to use matplotlib.dates. The following error messages > were generated when I tried to run matplotlib-0.87.4/examples/date_demo1.py > > Any Idea on how I can get dates working again? > (I am running the 2.6.17.6 kernel on a 64-bit linux system) Richard, in matplotlib/dates.py, change line 155 from remainder = x - ix to remainder = float(x) - ix The problem is that matplotlib uses numpy arrays for the xaxis. As you have a 64b system, the arrays are in float64scalars, that divmod doesn't know how to process (unless you have a very recent of numpy). The trick above forces a downcasting of float64scalar to float32scalar, divmod can now work. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dates fail after upgrade
> "PGM" == PGM <[EMAIL PROTECTED]> writes: PGM> Richard, in matplotlib/dates.py, change line 155 from PGM> remainder = x - ix to remainder = float(x) - ix Thanks for th tip -- I'll commit this to svn. JDH - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] polygon bug
Dear matplotlib-users, I'd like to report a bug in Polygon, which is crashing with an unhelpful error message where an exception would be appropriate. The problem occurs when you feed Polygon an Nx2 array instead of an N- length list of 2-tuples. This is on my PPC OSX system, with everything freshly checked out from SVN (should the matplotlib version still be 0.87.4?). Versions: In [152]: numpy.__version__ Out[152]: '1.1.2881' In [154]: matplotlib.__version__ Out[154]: '0.87.4' Code: import pylab, numpy theta = numpy.pi/4*numpy.arange(9,dtype=float) x = numpy.cos(theta) y = numpy.sin(theta) # The following line works #p = pylab.Polygon(zip(x,y)) # The following line causes a crash p = pylab.Polygon(numpy.vstack((x,y)).T) ax = pylab.subplot(111) ax.add_patch(p) pylab.show() Output: In [155]: run plot_polygon.py --- exceptions.TypeError Traceback (most recent call last) /Users/nvf/Documents/S.M. Thesis/plot_polygon.py 10 11 ax = pylab.subplot(111) ---> 12 ax.add_patch(p) 13 pylab.show() 14 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes.py in add_patch(self, p) 899 p.get_transform(), p.get_verts()) 900 #for x,y in xys: print x,y --> 901 self.update_datalim(xys) 902 self.patches.append(p) 903 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes.py in update_datalim(self, xys) 913 # Otherwise, it will compute the bounds of it's current data 914 # and the data in xydata --> 915 self.dataLim.update(xys, -1) 916 917 TypeError: CXX : Error creating object of type N2Py5TupleE WARNING: Failure executing file: Instead of converting from crash to exception, though, would it be possible to make it accept an Nx2 array? Please at least cc me in any replies, as I am not subscribed to this list. Thanks, Nick - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polygon bug
Nick, Thanks for the bug report. I have been making some changes to use numerix more consistently internally, and fixing this bug would be a step in that direction. I will take a look. Eric Nick Fotopoulos wrote: > Dear matplotlib-users, > > I'd like to report a bug in Polygon, which is crashing with an > unhelpful error message where an exception would be appropriate. The > problem occurs when you feed Polygon an Nx2 array instead of an N- > length list of 2-tuples. This is on my PPC OSX system, with > everything freshly checked out from SVN (should the matplotlib > version still be 0.87.4?). > > Versions: > In [152]: numpy.__version__ > Out[152]: '1.1.2881' > In [154]: matplotlib.__version__ > Out[154]: '0.87.4' > > > Code: > import pylab, numpy > > theta = numpy.pi/4*numpy.arange(9,dtype=float) > > x = numpy.cos(theta) > y = numpy.sin(theta) > > # The following line works > #p = pylab.Polygon(zip(x,y)) > > # The following line causes a crash > p = pylab.Polygon(numpy.vstack((x,y)).T) > > ax = pylab.subplot(111) > ax.add_patch(p) > pylab.show() > > > Output: > In [155]: run plot_polygon.py > > --- > exceptions.TypeError Traceback (most > recent call last) > > /Users/nvf/Documents/S.M. Thesis/plot_polygon.py > 10 > 11 ax = pylab.subplot(111) > ---> 12 ax.add_patch(p) > 13 pylab.show() 14 > > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- > packages/matplotlib/axes.py in add_patch(self, p) > 899 p.get_transform(), p.get_verts()) > 900 #for x,y in xys: print x,y > --> 901 self.update_datalim(xys) > 902 self.patches.append(p) > 903 > > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- > packages/matplotlib/axes.py in update_datalim(self, xys) > 913 # Otherwise, it will compute the bounds of it's > current data > 914 # and the data in xydata > --> 915 self.dataLim.update(xys, -1) > 916 > 917 > > TypeError: CXX : Error creating object of type N2Py5TupleE > WARNING: Failure executing file: > > > Instead of converting from crash to exception, though, would it be > possible to make it accept an Nx2 array? > > Please at least cc me in any replies, as I am not subscribed to this > list. > > Thanks, > Nick > > - > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polygon bug
Nick, svn 2635 has a fix for this bug. Eric Nick Fotopoulos wrote: > Dear matplotlib-users, > > I'd like to report a bug in Polygon, which is crashing with an > unhelpful error message where an exception would be appropriate. The > problem occurs when you feed Polygon an Nx2 array instead of an N- > length list of 2-tuples. This is on my PPC OSX system, with > everything freshly checked out from SVN (should the matplotlib > version still be 0.87.4?). > > Versions: > In [152]: numpy.__version__ > Out[152]: '1.1.2881' > In [154]: matplotlib.__version__ > Out[154]: '0.87.4' > > > Code: > import pylab, numpy > > theta = numpy.pi/4*numpy.arange(9,dtype=float) > > x = numpy.cos(theta) > y = numpy.sin(theta) > > # The following line works > #p = pylab.Polygon(zip(x,y)) > > # The following line causes a crash > p = pylab.Polygon(numpy.vstack((x,y)).T) > > ax = pylab.subplot(111) > ax.add_patch(p) > pylab.show() - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot swaps axes specified with extent
Stefan van der Walt wrote: > On Thu, Jul 27, 2006 at 08:57:47PM -0400, PGM wrote: > >>>Is this normal? If so, how do I get around the problem? I also >>>noticed that, even without extents, the image gets scaled after >>>plotting. >> >>Try to set the "_autoscale" parameter of your current 'axes' to False. That >>way, you should avoid any inopportune rescaling. For the image, try to use >>aspect='auto'. >> >>For example, >> >>P.imshow(x,extent=(0,x.shape[1],x.shape[0],0)) >>P.gca().set_autoscale_on(False) > > > Thanks, P., that did the trick! It looks like the right way to fix > the scaling of the axes extents, but I am still not sure whether the > axis flipping behaviour I described earlier is correct. I changed it in svn 2636; now Axes.autoscale_view() preserves axis direction. I think this will be generally useful and will cause less user surprise than the previous behavior. Eric - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users