Re: [Matplotlib-users] Displaying several points with different colors
I manage to do what I wanted to do, it was not that easy - the colours were in an array I had to transform into an array of tuples, the autoscale did not function, I had to put in the fig.subplot the correct xlim and ylim -, but now it works like a charm. Many thanks. Matthieu 2007/3/9, John Hunter <[EMAIL PROTECTED]>: On 3/9/07, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > What I have is a set of points in a numpy.array - for instance size (2000, > 2) -. What I have as well is a nump.array of size (2000, 3). How can I make > plot understand that each line of the set points must be painted with the > corresponding line in the colour array ? You'll probably want to use a regular poly collection, as in the example below. Your array of facecolors can pretty much be whatever you want: from pylab import figure, nx, show, cm from matplotlib.collections import RegularPolyCollection fig = figure() ax = fig.add_subplot(111) offsets = nx.mlab.rand(20,2) facecolors = [cm.jet(x) for x in nx.mlab.rand(20)] black = (0,0,0,1) collection = RegularPolyCollection( fig.dpi, numsides=5, # a pentagon rotation=0, sizes=(50,), facecolors = facecolors, edgecolors = (black,), linewidths = (1,), offsets = offsets, transOffset = ax.transData, ) ax.add_collection(collection) show() > Matthieu > > - > 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] Displaying several points with different colors
OK, I'm trying to the same but in 3D, and there, no documentaion. I tried to launch axes3d.py to see exactly what I can do, but the example file does not work. For instance, Axes3D takes two parameters for method __init__ and only one is provided. Did someone test it ? I'm trying to use collection as well, but for once I prefer MatLab simplicity here, it's way to complicated, some arguments must be zipped, other are passed not in the collection, but when the collection is added to the subplot, ... Is there a simple and clear way to do 3D plotting with collections ? Matthieu 2007/3/12, Matthieu Brucher <[EMAIL PROTECTED]>: I manage to do what I wanted to do, it was not that easy - the colours were in an array I had to transform into an array of tuples, the autoscale did not function, I had to put in the fig.subplot the correct xlim and ylim -, but now it works like a charm. Many thanks. Matthieu 2007/3/9, John Hunter <[EMAIL PROTECTED]>: > > On 3/9/07, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > > > What I have is a set of points in a numpy.array - for instance size > (2000, > > 2) -. What I have as well is a nump.array of size (2000, 3). How can I > make > > plot understand that each line of the set points must be painted with > the > > corresponding line in the colour array ? > > You'll probably want to use a regular poly collection, as in the > example below. Your array of facecolors can pretty much be whatever > you want: > > from pylab import figure, nx, show, cm > from matplotlib.collections import RegularPolyCollection > > > fig = figure() > ax = fig.add_subplot(111) > > offsets = nx.mlab.rand(20,2) > facecolors = [cm.jet(x) for x in nx.mlab.rand(20)] > black = (0,0,0,1) > > collection = RegularPolyCollection( > fig.dpi, > numsides=5, # a pentagon > rotation=0, > sizes=(50,), > facecolors = facecolors, > edgecolors = (black,), > linewidths = (1,), > offsets = offsets, > transOffset = ax.transData, > ) > > ax.add_collection (collection) > > show() > > > > > > > > > Matthieu > > > > > - > > 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
[Matplotlib-users] matplotlib._ns_transforms.so: undefined symbol: _ZNSs4_Rep20_S_empty_rep_storageE
Hi All, I am using matplotlib-0.90.0 with numpy-1.0.1 for my python program which I later convert in to an executable with the help of pyinstaller, I am installing matplotlib-0.90.0 from source and it installs fine.when I create the executable of my program (I include matplotlib as a .pkg in it) and run it I get the following error only on linux , it fails at with this message matplotlib._ns_transforms.so: undefined symbol: _ZNSs4_Rep20_S_empty_rep_storage but same set of source of matplotlib-0.90.0 with numpy-1.0.1 installed from source works fine on windows and solaris,any idea what is going wrong here? I am using gcc version 3.4.3 on red hat linux 2.6.9-11 Here is the complete stack trace Extracting mpl-data.pkg data ... ok Extracting numpy.pkg data ... ok working dir /home/rik/output/var/projects /home/rik/are_new/exe/linux/buildare_top/out1.pyz/matplotlib:931: UserWarning: Could not find matplotlibrc; using defaults /home/rik/are_new/exe/linux/buildare_top/out1.pyz/matplotlib:982: UserWarning: could not find rc file; returning defaults The import of the numpy version of the _transforms module, _ns_transforms, failed. This is is either because numpy was unavailable when matplotlib was compiled, because a dependency of _ns_transforms could not be satisfied, or because the build flag for this module was turned off in setup.py. If it appears that _ns_transforms was not built, make sure you have a working copy of numpy and then re-install matplotlib. Otherwise, the following traceback gives more details: Traceback (most recent call last): File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/exe_harness", line 97, in __init__ File "", line 69, in dispatch File "", line 109, in handleReportRequest File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 398, in doimport exec co in mod.__dict__ File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/convert_dom", line 12, in ? File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 398, in doimport exec co in mod.__dict__ File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/report", line 29, in ? File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 398, in doimport exec co in mod.__dict__ File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/page_setup", line 14, in ? File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 398, in doimport exec co in mod.__dict__ File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/graph_view", line 11, in ? File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 398, in doimport exec co in mod.__dict__ File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/pylab", line 1, in ? File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 398, in doimport exec co in mod.__dict__ File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/matplotlib.pylab", line 203, in ? File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 398, in doimport exec co in mod.__dict__ File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/matplotlib.axes", line 14, in ? File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 398, in doimport exec co in mod.__dict__ File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/matplotlib.artist", line 4, in ? File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 398, in doimport exec co in mod.__dict__ File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/matplotlib.transforms ", line 223, in ? File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 398, in doimport exec co in mod.__dict__ File "/home/rik/are_new/exe/linux/buildare_top/out1.pyz/matplotlib._transform s", line 17, in ? File "/home/rik/pyinstaller-1.3/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/home/rik/pyinstaller-1.3/iu.py", line 373, in doimport mod = importfunc(nm) File "/home/rik/pyinstaller-1.3/iu.py", line 215, in ge
Re: [Matplotlib-users] Displaying several points with different colors
Matthieu Brucher wrote: > OK, I'm trying to the same but in 3D, and there, no documentaion. > I tried to launch axes3d.py to see exactly what I can do, but the > example file does not work. For instance, Axes3D takes two parameters > for method __init__ and only one is provided. Did someone test it ? > I'm trying to use collection as well, but for once I prefer MatLab > simplicity here, it's way to complicated, some arguments must be zipped, > other are passed not in the collection, but when the collection is added > to the subplot, ... > Is there a simple and clear way to do 3D plotting with collections ? There may be, but all 3D plotting is shaky right now. The 3D code is essentially unmaintained and unsupported. 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
Re: [Matplotlib-users] Displaying several points with different colors
There may be, but all 3D plotting is shaky right now. The 3D code is essentially unmaintained and unsupported. Eric Sad to hear this, I hope someone will enhance it :) Matthieu - 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] Displaying several points with different colors
Matthieu Brucher wrote: > I manage to do what I wanted to do, it was not that easy - the colours > were in an array I had to transform into an array of tuples, the > autoscale did not function, I had to put in the fig.subplot the correct > xlim and ylim -, but now it works like a charm. > Many thanks. What version of mpl are you using? In recent versions, the collections should accept 2D numpy arrays as well as any sequence of tuples (and several other possibilities). Autoscaling does not work well with arbitrary collections because there is a chicken-and-egg problem: a collection member may be drawn in pixels or other physical units, in which case its size in data units cannot be determined until it is drawn with a given xlim and ylim (and sometimes dpi). 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
Re: [Matplotlib-users] Displaying several points with different colors
What version of mpl are you using? The latest, I compiled it from the source as FC5 has a very old version - can't update myself the distribution - In recent versions, the collections should accept 2D numpy arrays as well as any sequence of tuples (and several other possibilities). For 2D plots, numpy arrays is accepted - but not for colors, it tells me there is a problem with tuples, I do not remember exactly, but I can check the error tomorrow -. For 3D plots, the offsets must be special, I suppose, as the array must be iterated on with a zip, I don't know why there is this need, but I didn't write it :) This difference in format is akward :| And the fact that the example file cannot be executed is still stranger. Autoscaling does not work well with arbitrary collections because there is a chicken-and-egg problem: a collection member may be drawn in pixels or other physical units, in which case its size in data units cannot be determined until it is drawn with a given xlim and ylim (and sometimes dpi). That is not my worst problem, I imposed the limits and it works now like a charm :) Matthieu - 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] PDF backend problem
Hi list, First of all, thanks to Bill Dandreta and Jouni Seppanen for helping with my combining single page pdf into multipage pdf question. I tried both method and went with pdftex because it's very simple (and fits my need). Now, I am running into another problem. Everything works fine up to 8 page plots. Starting with the 9th page, MPL chokes at line 1084 in backend_pdf.py and couldn't find the cooresponding ttf file (VeraSe.ttf) but it had no problem reading that file for the first 8 plots. ??? Regards, -- John Henry - 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] PDF backend problem
[EMAIL PROTECTED] writes: > Now, I am running into another problem. Everything works fine up to > 8 page plots. Starting with the 9th page, MPL chokes at line 1084 in > backend_pdf.py and couldn't find the cooresponding ttf file > (VeraSe.ttf) but it had no problem reading that file for the first 8 > plots. Does the following change help with this? (If you are following svn, just run "svn update"; otherwise, the easiest way is to replace line 1084 by the three lines prefixed with + below.) Index: backend_pdf.py === --- backend_pdf.py (revision 3044) +++ backend_pdf.py (revision 3045) @@ -1081,7 +1081,9 @@ font = self.afm_font_cache.get(key) if font is None: filename = fontManager.findfont(prop, fontext='afm') -font = AFM(file(filename)) +fh = file(filename) +font = AFM(fh) +fh.close() self.afm_font_cache[key] = font return font -- Jouni K. Seppänen http://www.iki.fi/jks - 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] PDF backend problem
I fixed another filehandle leak in the pdf backend, so here's a more complete patch. There are also several cases of file(...) being passed to pickle.dump or pickle.load in font_manager.py. I was going to take care of these by writing some utility functions, but I started wondering why the import of cPickle or pickle is done only within methods of FontManager and not at the top level. Are there some platforms where neither is available, or what is the rationale? Index: backend_pdf.py === --- backend_pdf.py (revision 3044) +++ backend_pdf.py (revision 3046) @@ -457,7 +457,9 @@ self.writeObject(self.fontObject, fonts) def _write_afm_font(self, filename): -font = AFM(file(filename)) +fh = file(filename) +font = AFM(fh) +fh.close() fontname = font.get_fontname() fontdict = { 'Type': Name('Font'), 'Subtype': Name('Type1'), @@ -1081,7 +1083,9 @@ font = self.afm_font_cache.get(key) if font is None: filename = fontManager.findfont(prop, fontext='afm') -font = AFM(file(filename)) +fh = file(filename) +font = AFM(fh) +fh.close() self.afm_font_cache[key] = font return font -- Jouni K. Seppänen http://www.iki.fi/jks - 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