Re: [Matplotlib-users] Is there a test suite for Matplotlib ?
There is a set of nose tests installed in matplotlib.tests. It can be invoked with: import matplotlib matplotlib.test() or (from the commandline): nosetests matplotlib.tests Mike On 06/27/2010 08:24 AM, Dr. David Kirkby wrote: Matplotlib is used as part of the Sage project, where we aim to run test-suites that are part of upstream packages where possible. Someone suggested it would be good if we did that for Matplotlib, which we currently do not do. However, on reading the contents of the source directory (README.txt, INSTALL etc) I could not find any reference to how to test Matplotlib. Is there such a test suite, and if so how does one invoke it? Dave -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Is there a test suite for Matplotlib ?
On 06/28/10 01:37 PM, Michael Droettboom wrote: There is a set of nose tests installed in matplotlib.tests. It can be invoked with: import matplotlib matplotlib.test() or (from the commandline): nosetests matplotlib.tests Mike Thank you Mike. We don't have 'nosetests' as a part of Sage, but it should be possible to write a script which just executes the first two lines. I'll add that to Sage so we can run the matplotlib test suite. Dave On 06/27/2010 08:24 AM, Dr. David Kirkby wrote: Matplotlib is used as part of the Sage project, where we aim to run test-suites that are part of upstream packages where possible. Someone suggested it would be good if we did that for Matplotlib, which we currently do not do. However, on reading the contents of the source directory (README.txt, INSTALL etc) I could not find any reference to how to test Matplotlib. Is there such a test suite, and if so how does one invoke it? Dave -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to save text in vector images as text rather than paths?
Just to note, in Linux, one can use the pdf2ps command. I believe Windows users can use GhostScript to convert a pdf into an eps file rather than using Illustrator for a simple conversion process. Ben Root On Sun, Jun 27, 2010 at 2:12 PM, Eric Firing efir...@hawaii.edu wrote: On 06/27/2010 08:06 AM, Eliss Parke wrote: I'm creating charts in matplotlib and saving them using savefig('chart.eps'). How can I make the labels actually be text rather than paths, which seems to be the default? (when I open the .eps files in Illustrator, I can't edit them as text) When you say labels, are you referring to the tick labels? If so, near the top of your script, try: import matplotlib matplotlib.rcParams['axes.unicode_minus'] = False Otherwise all tick labels are treated as unicode by default, and unicode is rendered in the ps backend as a sequence of glyphs rather than as a single text string. You might also consider using matplotlib to write pdf files instead of ps. The eps format is older and more limited in its capabilities than pdf. You can always convert pdf to eps as a last step, if eps is what you ultimately need. I've never used Illustrator, but I presume it can happily import pdf and export eps. Eric I'm using the latest matplotlib and python on Windows XP. Thanks Eliss -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] progress bar?
I've been searching but coudn't find any example on how to add a progress bar to a wxpython+matplotlib app. I'd like my app to show a progress bar while some gridding and contouring are being done. this is the code I'm using (without preogress bar) funcs = {Natural Neighbor:'nn', Triangulation:'linear',Multiquadric:'multiquadric',Inverse Multiquadric:'inverse multiquadric',Gaussian:'gaussian',Linear RBF:'linear',Cubic:'cubic',Quintic:'quintic',Thin-plate Spline:'thin-plate'} # check what kind of interpolation are we using if interp == 'Natural Neighbor' or interp == 'Triangulation': # Delaunay-based (mlab) xi = yi = np.linspace(-1.1,1.1,ngrid) zi = griddata(node_x,node_y,z,xi,yi,interp=funcs[interp]) else: # Radial basis functions (scipy) ti = np.linspace(-1.1,1.1,ngrid) xi, yi = np.meshgrid(ti, ti) rbf = Rbf(node_x, node_y, z, function=funcs[interp],epsilon=epsilon,smooth=smoothing) zi = rbf(xi, yi) ## we only want the points that lie inside the circle, ## so we have to create a polygon to select the interpolated values polyXY = [] u = np.arange(0,361,1) t = np.radians(u) x = np.cos(t) y = np.sin(t) polyXY.append(zip(x,y)) verts = np.array(polyXY) verts = verts[0] xyflat = zip(xi.flat,yi.flat) pmask = points_inside_poly(xyflat, verts) pmask2 = np.reshape(pmask,(ngrid,ngrid)) zmask = ma.masked_where(pmask2==False,zi) zi = zmask axes.contour(xi,yi,zi) TIA Carlos -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] progress bar?
Carlos Grohmann wrote: I've been searching but coudn't find any example on how to add a progress bar to a wxpython+matplotlib app. I'd like my app to show a progress bar while some gridding and contouring are being done. this is the code I'm using (without preogress bar) funcs = {Natural Neighbor:'nn', Triangulation:'linear',Multiquadric:'multiquadric',Inverse Multiquadric:'inverse multiquadric',Gaussian:'gaussian',Linear RBF:'linear',Cubic:'cubic',Quintic:'quintic',Thin-plate Spline:'thin-plate'} # check what kind of interpolation are we using if interp == 'Natural Neighbor' or interp == 'Triangulation': # Delaunay-based (mlab) xi = yi = np.linspace(-1.1,1.1,ngrid) zi = griddata(node_x,node_y,z,xi,yi,interp=funcs[interp]) else: # Radial basis functions (scipy) ti = np.linspace(-1.1,1.1,ngrid) xi, yi = np.meshgrid(ti, ti) rbf = Rbf(node_x, node_y, z, function=funcs[interp],epsilon=epsilon,smooth=smoothing) zi = rbf(xi, yi) ## we only want the points that lie inside the circle, ## so we have to create a polygon to select the interpolated values polyXY = [] u = np.arange(0,361,1) t = np.radians(u) x = np.cos(t) y = np.sin(t) polyXY.append(zip(x,y)) verts = np.array(polyXY) verts = verts[0] xyflat = zip(xi.flat,yi.flat) pmask = points_inside_poly(xyflat, verts) pmask2 = np.reshape(pmask,(ngrid,ngrid)) zmask = ma.masked_where(pmask2==False,zi) zi = zmask axes.contour(xi,yi,zi) TIA Carlos Hello Carlos, Is the wx ProgressDialog class not suitable for your application? -- jv -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] progress bar?
On Mon, Jun 28, 2010 at 11:31 AM, Jim Vickroy jim.vick...@noaa.gov wrote: Carlos Grohmann wrote: I've been searching but coudn't find any example on how to add a progress bar to a wxpython+matplotlib app. I'd like my app to show a progress bar while some gridding and contouring are being done. Or, if you don't want a separate dialog popping up, just use wx.Gauge--it is a progress bar, and you can choose to put it near (maybe under) your plot in the layout. Che -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] interpolation 2d: delaunay and griddata, bad results
The griddata function should be doing delaunay triangulation by default, so the result from griddata should be identical to the second plot. I see that you are using a mask for x0, y0, v0. This is unnescessary, as you really want to pass the flat arrays. I can not get a masked array from griddata. Actually, I have to pass in flat arrays to make it work at all. And the result is identical to the second plot: ui = pylab.mlab.griddata(x0.flat, y0.flat, v0.flat, xi, yi) As to whether the result is correct or not, I am not qualified to say, so I will leave that to someone else to determine. Ben Root On Sun, Jun 27, 2010 at 8:28 PM, Martinho MA m...@ua.pt wrote: Hello, I need to interpolate from a 2d grid to another one. I tryed to use griddata (with natgrid) but the returned data if fully masked. So, I used directly delaunay triangulation and I obtained quite bad results!! I send attached a small code and the output figure as png. I also send my data as npz (32k). To generate it just run python test.py 1 or from python: import test test.go() Thanks for the help mma matplotlib.__version__ 0.99.1 uname -a Linux cxx 2.6.25.20-0.7-default #1 SMP 2010-02-26 20:32:57 +0100 x86_64 x86_64 x86_64 GNU/Linux -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to save text in vector images as text rather than paths?
On 06/28/2010 04:30 AM, Benjamin Root wrote: Just to note, in Linux, one can use the pdf2ps command. I believe I recommend the pdftops command if you have it, instead of pdf2ps. At least on my system (ubuntu 10.04), pdf2ps seems to be embedding coarse bit-mapped versions of the fonts. The output looks pretty bad. Eric Windows users can use GhostScript to convert a pdf into an eps file rather than using Illustrator for a simple conversion process. Ben Root On Sun, Jun 27, 2010 at 2:12 PM, Eric Firing efir...@hawaii.edu mailto:efir...@hawaii.edu wrote: On 06/27/2010 08:06 AM, Eliss Parke wrote: I'm creating charts in matplotlib and saving them using savefig('chart.eps'). How can I make the labels actually be text rather than paths, which seems to be the default? (when I open the .eps files in Illustrator, I can't edit them as text) When you say labels, are you referring to the tick labels? If so, near the top of your script, try: import matplotlib matplotlib.rcParams['axes.unicode_minus'] = False Otherwise all tick labels are treated as unicode by default, and unicode is rendered in the ps backend as a sequence of glyphs rather than as a single text string. You might also consider using matplotlib to write pdf files instead of ps. The eps format is older and more limited in its capabilities than pdf. You can always convert pdf to eps as a last step, if eps is what you ultimately need. I've never used Illustrator, but I presume it can happily import pdf and export eps. Eric I'm using the latest matplotlib and python on Windows XP. Thanks Eliss -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first http://sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first http://sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to save text in vector images as text rather than paths?
Hmm, there is definitely a difference in qualiity. Thanks for the tip!/ Ben Root On Mon, Jun 28, 2010 at 11:46 AM, Eric Firing efir...@hawaii.edu wrote: On 06/28/2010 04:30 AM, Benjamin Root wrote: Just to note, in Linux, one can use the pdf2ps command. I believe I recommend the pdftops command if you have it, instead of pdf2ps. At least on my system (ubuntu 10.04), pdf2ps seems to be embedding coarse bit-mapped versions of the fonts. The output looks pretty bad. Eric Windows users can use GhostScript to convert a pdf into an eps file rather than using Illustrator for a simple conversion process. Ben Root On Sun, Jun 27, 2010 at 2:12 PM, Eric Firing efir...@hawaii.edu mailto:efir...@hawaii.edu wrote: On 06/27/2010 08:06 AM, Eliss Parke wrote: I'm creating charts in matplotlib and saving them using savefig('chart.eps'). How can I make the labels actually be text rather than paths, which seems to be the default? (when I open the .eps files in Illustrator, I can't edit them as text) When you say labels, are you referring to the tick labels? If so, near the top of your script, try: import matplotlib matplotlib.rcParams['axes.unicode_minus'] = False Otherwise all tick labels are treated as unicode by default, and unicode is rendered in the ps backend as a sequence of glyphs rather than as a single text string. You might also consider using matplotlib to write pdf files instead of ps. The eps format is older and more limited in its capabilities than pdf. You can always convert pdf to eps as a last step, if eps is what you ultimately need. I've never used Illustrator, but I presume it can happily import pdf and export eps. Eric I'm using the latest matplotlib and python on Windows XP. Thanks Eliss -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first http://sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first http://sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Symbol not found
I just tried compiling with the following command: sudo make -f make.osx fetch deps mpl_build mpl_install At first it was failing almost immediately, but then I changed make.osx so that it was fetching zlib-1.2.5 and it got further but still failed. The log is at the link below: http://pastebin.org/363644 On Mon, Jun 28, 2010 at 9:36 AM, Ranjit Chacko rjcha...@gmail.com wrote: I edited the make.osx file also which you can see here: http://titanpad.com/94eSOCozk4 On Mon, Jun 28, 2010 at 9:19 AM, Ranjit Chacko rjcha...@gmail.com wrote: Thanks so much for your help. I really appreciate it. This is what I get when I run otool: ft2font.so (architecture ppc7400): /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.11) /usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 47.1.0) ft2font.so (architecture i386): /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.11) /usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) This is the output of gcc --version: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664) And the output of g++: i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664) I'm not really sure what the steps I followed are anymore. After things didn't work I just tried different things I saw described on different blogs or mailing list archives. I'm not sure if I used pkg-config though. I'm trying to compile matplotlib on 10.6. At first nothing was working, and then I downloaded Xcode again and checked off the option to include the 10.4 libraries, so both are present now. Both gcc-.40 and gcc-4.2 are present but I'm not really sure what's being used when. Thanks again. -Ranjit On Sun, Jun 27, 2010 at 2:22 PM, Friedrich Romstedt friedrichromst...@gmail.com wrote: First, since you said you used pkg-config I would like to know what libfreetype the ft2font.so lib is actually linked against. Can you issue an otool -L ft2font.so in the matplotlib's directory? This will tell you what libs are used. I think most important is the compiler used, but since you are on 10.4 apparently, I don't know what the recent compiler for you is. Is it gcc-4.0? (It seems to be.) Are there other gcc's around which could have been used for the libfreetype2, or for Python itself? Can you issue in a clean shell gcc --version, and it seems you used c++ as the command for .cpp sources, right, so can you issue c++ --version too? And what were your steps to get it build from the weird errors you posted before (I didn't get a clue from them). I don't know if I can help you but at least I can try to, right Friedrich 2010/6/25 Ranjit Chacko rjcha...@gmail.com: I finally somehow managed to get matplotlib to compile but now when I try to import matplotlib.pyplot I get the following error: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so Expected in: dynamic lookup -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] zorder for individual points in a scatter plot on a Basemap
Hi, I'm currently using a scatter plot on a Basemap and I'd like to set the zorder of the individual points based on their temperature. The higher the temperature, the higher the zorder. Also, i'm using a colorbar to set the colors for the plot. Here is a snippet of my code: x = np.array(val) fig.sca(ax1) lon_0 =(urcrnrlon+llcrnrlon)/2 lat_0 =(urcrnrlat+llcrnrlat)/2 m = Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon, urcrnrlat=urcrnrlat,resolution='i',projection='cyl',lon_0=lon_0,lat_0=lat_0) m.drawcoastlines() m.drawmapboundary() m.drawparallels(np.arange(llcrnrlat-1,urcrnrlat+1,5.)) m.drawmeridians(np.arange(llcrnrlon-1,urcrnrlon+1,5.)) m.fillcontinents(color='white',lake_color='aqua') m.drawcountries(linewidth=1) lons,lats = m(lon,lat) #I can do it this way, but this screws up the colorbar #for i in range(len(x)): # m.scatter(lons[i],lats[i],c=x[i],marker='o',picker=5,zorder=x[i]) m.scatter(lons,lats,c=x,marker='o',picker=5) plt.title('Time Range: %s to %s'%(startDay.strftime(%b-%d %H:%M),endDay.strftime(%b-%d %H:%M))) plt.colorbar(shrink=0.5) Is there anyway to set the zorder of the points without using the loop in commented code? Any help would be greatly appreciated. Thanks, Aman -- Aman Thakral B.Eng Biosci, M.Eng Design -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap broken with matplotlib 0.99.3?
If you don't mind trying developer releases, use basemap 0.99.5 from http://www.lfd.uci.edu/~gohlke/pythonlibs/#basemap, which should work with numpy 1.4.1. Success! (well, the import worked) I can also report success with the developer release. Works a treat with numpy 1.4.1. Very nice. --Bill Eaton -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] colorbar rescaling
Hi, I hope someone can answer this colorbar related question. I have a plot, to which I am drawing a colorbar. The standard colorbar ranges from the values -1 (blue) over 0 (green) to e.g. 1(red). So far so good. But now I want to change the colorbar that it shows only the colors between 0 and 1. What I mean is: the colorbar should start at value 0 (with green) and go to 1(red), and leave the original plot unchanged. I ad some example code below to make it more clear. In the example plot created, only the values between 0 and 1 are interesting and should be shown in the colorbar, but not -1 (blue). But I want the original plot unchanged! If anyone has an idea that would be great. Cheers Alex import numpy as np import matplotlib import pylab as py f = py.figure() # create toy image im = -np.ones((100,100)) for x in range(20,80): for y in range(20,80): im[x,y] = random.random() # create imshow subplot ax = f.add_subplot(111) result = ax.imshow(im) # Create the colorbar axc, kw = matplotlib.colorbar.make_axes(ax) cb = matplotlib.colorbar.Colorbar(axc, result) # Set the colorbar result.colorbar = cb py.show() -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Symbol not found
It didn't work. But I may have misunderstood your instructions. Here's the output from compiling matplotlib: http://pastebin.org/363870 Here's what I did. Set export CC=gcc-4.2 Set export MACOSX_DEPLOYMENT_TARGET=10.5 Downloaded and compiled libpng-1.4.3 Downloaded and compiled libfreetype-2.3.12 Downloaded matplotlib-0.99.3 Modified src/_png.cpp in matplotlib Replaced setupext.py with your version. sudo python setup.py build sudo python setup.py install Any obvious mistakes? Thanks again for your help, -Ranjit On Mon, Jun 28, 2010 at 1:05 PM, Friedrich Romstedt friedrichromst...@gmail.com wrote: 2010/6/28 Ranjit Chacko rjcha...@gmail.com: I just tried compiling with the following command: sudo make -f make.osx fetch deps mpl_build mpl_install I don't know, I saw now so many people running into trouble with make.osx, would you, as a test case, please apply the following steps to your installation: First, I see that the freetype is linked in statically, but still it cannot be loaded on startup time (this _something_foobar symbol seems the first one it attemts to load). I remember that make.osx is intended for binary distributable generation, and therefore it links statically. I want to propose a different solution here. Would you please modify first your matplotlib setupext.py in the following way. We'll attemt a build without make.osx and fetch etc., but a real distutil build with dynamic linking :-) !: On the line with 'darwin' : [], add: 'darwin' : ['/usr/local'], and maybe also '/usr/X11/lib' or '/usr/X11' and let the /lib suffix alone, but I think as you installed pkg-config, it could maybe work also out of the box. For me, I were not aware of pkg-config for OS X, so I still don't have it :-). If you are not sure, simply try to run pkg-config in the console, by tab expansion, if it finds it, it's installed. I also attach the modified files for your convenience, but you should use diff because I built that time 0.99.1.2, and something may have changed by that. Then, please compile (if you did not already do that), libpng 1.4 (not 1.2!) and libfreetype2 from the official sources. Always use the following environment variables: export CC=gcc-4.2 (To not use 4.0 occasionally) export MACOSX_DEPLOYMENT_TARGET=10.5 (To avoid certain warnings which are quite annoying during build. If you attemt to use py2app for deployment on 10.3 or 10.4 you should modify of course.) It is important that you compile *all* your software which is incorporated with the same variables. Well, at least I by accident one time set _TARGET to another value after ./configure, and it refused to compile then. So, feel free to experiment, but please document properly and, most important, tell us the results! I'm still in the ascending branch of my OS X learning curve. Maybe now it's the right moment to compile Python (1.6.5, I think not 1.7) and then numpy again with this settings. For Python, use ./configure --enable-framework Then compile libfreetype2. Compile libpng 1.4 or whatever. Now it's time to compile matplotlib itself. Just use the usual flags, and, for me, it worked like a charm. But one modification has to be made: matplotlib isn't compatible with libpng 1.4 from the beginning, please add the following lines to src/_png.cpp: #define png_infopp_NULL (png_infopp)NULL #define int_p_NULL (int*)NULL Somewhere before the actual code, it doesn't matter where, but after the #include png.cpp of course. I also attach the file, same applies, run diff before. It's my obligation to provide a proper matplotlib patch for this issue, but for now please patch by hand. There are several reasons why to compile Python yourself: It will use the new Tcl/Tk, which is much more beautiful than the old one. It will compile with the compatible flags. Well that's it I think. If you intend to use PIL btw, you have to compile Python yourself. Now you should be done. If you run into some problems, please tell us. Friedrich -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] colorbar rescaling
2010/6/28 Alexander Dietz alexanderdie...@googlemail.com: I have a plot, to which I am drawing a colorbar. The standard colorbar ranges from the values -1 (blue) over 0 (green) to e.g. 1(red). So far so good. But now I want to change the colorbar that it shows only the colors between 0 and 1. What I mean is: the colorbar should start at value 0 (with green) and go to 1(red), and leave the original plot unchanged. Ah, it wasn't that easy (for me). Friedrich help.py Description: Binary data -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] abort trap
I've been having some trouble with compiling matplotlib on Snow Leopard. I managed to get rid of all my old problems by recompiling everything with gcc-4.2. But now when I import matplotlib.pyplot I get an Abort trap message and python quits. Here is part of the error message I get: Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libSystem.B.dylib 0x7fff84a893d6 __kill + 10 1 libSystem.B.dylib 0x7fff84b29972 abort + 83 2 libgcc_s.1.dylib 0x000100487d51 uw_init_context_1 + 385 3 libgcc_s.1.dylib 0x0001004884cc _Unwind_Resume + 76 4 ft2font.so0x0001017b046d FT2Font::FT2Font(std::string) + 4269 (Extensions.hxx:629) 5 ft2font.so0x0001017b0af8 ft2font_module::new_ft2font(Py::Tuple const) + 408 (ft2font.cpp:1728) 6 ft2font.so0x0001017b3d52 Py::ExtensionModuleft2font_module::invoke_method_varargs(std::string const, Py::Tuple const) + 162 (Extensions.hxx:422) 7 ft2font.so0x0001017c25a0 method_varargs_call_handler + 512 It seems like freetype is the problem and from a little googling I see that the sage developers also had a problem with this. Does anyone know how to fix this? Thanks, -Ranjit -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] abort trap
I tried again by compiling version 2.4.11 of freetype instead of the latest and recompiling matplotlib with that and now I get the following less severe error: Traceback (most recent call last): File stdin, line 1, in module File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pyplot.py, line 6, in module from matplotlib.figure import Figure, figaspect File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py, line 18, in module from axes import Axes, SubplotBase, subplot_class_factory File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py, line 12, in module import matplotlib.axis as maxis File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py, line 10, in module import matplotlib.font_manager as font_manager File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py, line 52, in module from matplotlib import ft2font ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so, 2): Library not loaded: /usr/local/lib/libfreetype.6.dylib Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so Reason: Incompatible library version: ft2font.so requires version 11.0.0 or later, but libfreetype.6.dylib provides version 10.0.0 On Mon, Jun 28, 2010 at 5:43 PM, Ranjit Chacko rjcha...@gmail.com wrote: I've been having some trouble with compiling matplotlib on Snow Leopard. I managed to get rid of all my old problems by recompiling everything with gcc-4.2. But now when I import matplotlib.pyplot I get an Abort trap message and python quits. Here is part of the error message I get: Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libSystem.B.dylib 0x7fff84a893d6 __kill + 10 1 libSystem.B.dylib 0x7fff84b29972 abort + 83 2 libgcc_s.1.dylib 0x000100487d51 uw_init_context_1 + 385 3 libgcc_s.1.dylib 0x0001004884cc _Unwind_Resume + 76 4 ft2font.so0x0001017b046d FT2Font::FT2Font(std::string) + 4269 (Extensions.hxx:629) 5 ft2font.so0x0001017b0af8 ft2font_module::new_ft2font(Py::Tuple const) + 408 (ft2font.cpp:1728) 6 ft2font.so0x0001017b3d52 Py::ExtensionModuleft2font_module::invoke_method_varargs(std::string const, Py::Tuple const) + 162 (Extensions.hxx:422) 7 ft2font.so0x0001017c25a0 method_varargs_call_handler + 512 It seems like freetype is the problem and from a little googling I see that the sage developers also had a problem with this. Does anyone know how to fix this? Thanks, -Ranjit -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users