[Matplotlib-users] Increase Padding Between Axis and Tick Labels
Hi How do I increase the distance/padding between the tick labels (numbers) and the axis/axes? Ted -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Example: Howto plot a 3d cube/pyramid with plotsurface in matplotlib
Since I haven't found an example, that shows howto plot in 3d a cube and pyramid, respectively, I wanted to show how I accomplished this without using vtk or mayavi. Unfortunately, it is a bit of an ugly hack, since as far as i know the plotsurface method cannot directly plot arrays with shape (,x). from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np fig=plt.figure() ax = Axes3D(fig) # Face 1 x1 = np.array([[0, 0, 1, 1, 0], [0, 0, 0, 0, 0]]) y1 = np.array([[0, 1, 1, 0, 0], [0, 0, 0, 0, 0]]) z1 = np.array([[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) # Face 2 x2 = np.array([[0, 0, 0.5, 0], [0, 0, 0, 0]]) y2 = np.array([[0, 1, 0.5, 0], [0, 0, 0, 0]]) z2 = np.array([[0, 0, 1, 0], [0, 0, 0, 0]]) # Face 3 x3 = np.array([[1, 1, 0.5, 1], [1, 1, 1, 1]]) y3 = np.array([[0, 1, 0.5, 0], [0, 0, 0, 0]]) z3 = np.array([[0, 0, 1, 0], [0, 0, 0, 0]]) # Face 4 x4 = np.array([[0, 1, 0.5, 0], [0, 0, 0, 0]]) y4 = np.array([[1, 1, 0.5, 1], [1, 1, 1, 1]]) z4 = np.array([[0, 0, 1, 0], [0, 0, 0, 0]]) # Face 5 x5 = np.array([[1, 0, 0.5, 1], [1, 1, 1, 1]]) y5 = np.array([[0, 0, 0.5, 0], [0, 0, 0, 0]]) z5 = np.array([[0, 0, 1, 0], [0, 0, 0, 0]]) ax.plot_surface(x1,y1,z1) ax.plot_surface(x2,y2,z2) ax.plot_surface(x3,y3,z3) ax.plot_surface(x4,y4,z4) ax.plot_surface(x5,y5,z5) plt.show() from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np fig=plt.figure() ax = Axes3D(fig) # Face 1 x1 = np.array([[0, 1, 1, 0, 0], [0, 0, 0, 0, 0]]) y1 = np.array([[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) z1 = np.array([[0, 0, 1, 1, 0], [0, 0, 0, 0, 0]]) # Face 2 x2 = np.array([[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) y2 = np.array([[0, 1, 1, 0, 0], [0, 0, 0, 0, 0]]) z2 = np.array([[0, 0, 1, 1, 0], [0, 0, 0, 0, 0]]) # Face 3 x3 = np.array([[0, 1, 1, 0, 0], [0, 0, 0, 0, 0]]) y3 = np.array([[0, 0, 1, 1, 0], [0, 0, 0, 0, 0]]) z3 = np.array([[1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) # Face 4 x4 = np.array([[0, 1, 1, 0, 0], [0, 0, 0, 0, 0]]) y4 = np.array([[1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) z4 = np.array([[0, 0, 1, 1, 0], [0, 0, 0, 0, 0]]) # Face 5 x5 = np.array([[0, 0, 1, 1, 0], [0, 0, 0, 0, 0]]) y5 = np.array([[0, 1, 1, 0, 0], [0, 0, 0, 0, 0]]) z5 = np.array([[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) # Face 6 x6 = np.array([[1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) y6 = np.array([[0, 1, 1, 0, 0], [0, 0, 0, 0, 0]]) z6 = np.array([[0, 0, 1, 1, 0], [0, 0, 0, 0, 0]]) ax.plot_surface(x1,y1,z1) ax.plot_surface(x2,y2,z2) ax.plot_surface(x3,y3,z3) ax.plot_surface(x4,y4,z4) ax.plot_surface(x5,y5,z5) ax.plot_surface(x6,y6,z6) plt.show() -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Increase Padding Between Axis and Tick Labels
On 9/13/2010 6:46 AM, Ted Kord wrote: How do I increase the distance/padding between the tick labels (numbers) and the axis/axes? http://matplotlib.sourceforge.net/users/customizing.html#customizing-matplotlib (see the pad options) hth, Alan Isaac -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Matplotlib wxpython gui template
Dear all, I have recently set up a simple tutorial on how to create gui applications with wxPython. One of the examples shows how to embed matplotlib plots in the application. It is only a recompilation of tutorials found on the web, including the matplotlib website, but the example is provided as a template application that can be downloaded and used to spawn plotting applications in minutes. In case you are interested, the tutorial is at www.oneminutepython.com. Best regards, Giancarlo -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] basemap and contouring
Hi, If I set up a random example and plot it as a contour it seems to work fine...e.g. import matplotlb.pyplot as plt import numpy as np data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) X, Y = np.meshgrid(x, y) plt.contour(X, Y, data2, colors='black') plt.show() However if instead I try use a basemap projection to do the contouring I run into trouble. For example... import numpy as np from mpl_toolkits.basemap import Basemap ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) X, Y = m(x, y) m.contourf(X, Y, data2, colors='black') plt.show() The errors I am getting are x, y = m(lons, lats) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py, line 823, in __call__ return self.projtran(x,y,inverse=inverse) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py, line 241, in __call__ outx,outy = self._proj4(x, y, inverse=inverse) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py, line 193, in __call__ _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck) File _proj.pyx, line 56, in _proj.Proj._fwd (src/_proj.c:725) RuntimeError: Buffer lengths not the same Many thanks, Martin -- View this message in context: http://old.nabble.com/basemap-and-contouring-tp29697864p29697864.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap and contouring
On Mon, Sep 13, 2010 at 7:45 AM, mdekauwe mdeka...@gmail.com wrote: Hi, If I set up a random example and plot it as a contour it seems to work fine...e.g. import matplotlb.pyplot as plt import numpy as np data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) X, Y = np.meshgrid(x, y) plt.contour(X, Y, data2, colors='black') plt.show() However if instead I try use a basemap projection to do the contouring I run into trouble. For example... import numpy as np from mpl_toolkits.basemap import Basemap ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) X, Y = m(x, y) m.contourf(X, Y, data2, colors='black') plt.show() You replaced the call to meshgrid with a call to the Basemap object. You need to use both: px,py = m(x, y) X,Y = np.meshgrid(px, py) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap and contouring
Hi, Well hopefully doing what you suggested correctly... numrows = 17 numcols = 16 ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) px, py = m(x, y) X, Y = np.meshgrid(px, py) m.contourf(X, Y, data2, colors='black') plt.show() Doesn't seem to work either? thanks, Martin Ryan May-3 wrote: On Mon, Sep 13, 2010 at 7:45 AM, mdekauwe mdeka...@gmail.com wrote: Hi, If I set up a random example and plot it as a contour it seems to work fine...e.g. import matplotlb.pyplot as plt import numpy as np data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) X, Y = np.meshgrid(x, y) plt.contour(X, Y, data2, colors='black') plt.show() However if instead I try use a basemap projection to do the contouring I run into trouble. For example... import numpy as np from mpl_toolkits.basemap import Basemap ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) X, Y = m(x, y) m.contourf(X, Y, data2, colors='black') plt.show() You replaced the call to meshgrid with a call to the Basemap object. You need to use both: px,py = m(x, y) X,Y = np.meshgrid(px, py) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://old.nabble.com/basemap-and-contouring-tp29697864p29698213.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap and contouring
On Mon, Sep 13, 2010 at 8:21 AM, mdekauwe mdeka...@gmail.com wrote: Hi, Well hopefully doing what you suggested correctly... numrows = 17 numcols = 16 ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) px, py = m(x, y) X, Y = np.meshgrid(px, py) m.contourf(X, Y, data2, colors='black') plt.show() Doesn't seem to work either? thanks, Martin Martin, Double-check the shape of the X and the Y arrays. Make sure they have the same shape as data2. I would be willing to bet that some of the shapes got reversed. Ben Root -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap and contouring
Hi, Well I tried... numrows = 17 numcols = 16 ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) print 'DATA2 shape:', data2.shape x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) print 'x shape:', x.shape print 'y shape:', y.shape px, py = m(x, y) which gives... DATA2 shape: (17, 16) x shape: (16,) y shape: (17,) So that looks OK. Turns out the error now comes at the line px, py = m(x, y). So perhaps I am doing the basemap step incorrectly? Traceback (most recent call last): File ./recontour_plot.py, line 83, in module px, py = m(x, y) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py, line 823, in __call__ return self.projtran(x,y,inverse=inverse) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py, line 241, in __call__ outx,outy = self._proj4(x, y, inverse=inverse) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py, line 193, in __call__ _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck) File _proj.pyx, line 56, in _proj.Proj._fwd (src/_proj.c:725) RuntimeError: Buffer lengths not the same Benjamin Root-2 wrote: On Mon, Sep 13, 2010 at 8:21 AM, mdekauwe mdeka...@gmail.com wrote: Hi, Well hopefully doing what you suggested correctly... numrows = 17 numcols = 16 ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) px, py = m(x, y) X, Y = np.meshgrid(px, py) m.contourf(X, Y, data2, colors='black') plt.show() Doesn't seem to work either? thanks, Martin Martin, Double-check the shape of the X and the Y arrays. Make sure they have the same shape as data2. I would be willing to bet that some of the shapes got reversed. Ben Root -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://old.nabble.com/basemap-and-contouring-tp29697864p29698610.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Increase Padding Between Axis and Tick Labels
Thanks Alan. working nicely now. Ted On 13 September 2010 13:27, Alan G Isaac alan.is...@gmail.com wrote: On 9/13/2010 6:46 AM, Ted Kord wrote: How do I increase the distance/padding between the tick labels (numbers) and the axis/axes? http://matplotlib.sourceforge.net/users/customizing.html#customizing-matplotlib (see the pad options) hth, Alan Isaac -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap and contouring
On 9/13/10 8:02 AM, mdekauwe wrote: Hi, Well I tried... numrows = 17 numcols = 16 ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) print 'DATA2 shape:', data2.shape x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) print 'x shape:', x.shape print 'y shape:', y.shape px, py = m(x, y) which gives... DATA2 shape: (17, 16) x shape: (16,) y shape: (17,) So that looks OK. Turns out the error now comes at the line px, py = m(x, y). So perhaps I am doing the basemap step incorrectly? Traceback (most recent call last): File ./recontour_plot.py, line 83, inmodule px, py = m(x, y) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py, line 823, in __call__ return self.projtran(x,y,inverse=inverse) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py, line 241, in __call__ outx,outy = self._proj4(x, y, inverse=inverse) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py, line 193, in __call__ _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck) File _proj.pyx, line 56, in _proj.Proj._fwd (src/_proj.c:725) RuntimeError: Buffer lengths not the same Martin: You need a meshgrid x,y = np.meshgrid(x,y) just *before* (not after) px,py = m(x,y) so that x and y have the same shape as data2. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : jeffrey.s.whita...@noaa.gov 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap and contouring
Hi Jeff, many thanks that was exactly the problem! Martin Jeff Whitaker wrote: On 9/13/10 8:02 AM, mdekauwe wrote: Hi, Well I tried... numrows = 17 numcols = 16 ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) print 'DATA2 shape:', data2.shape x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) print 'x shape:', x.shape print 'y shape:', y.shape px, py = m(x, y) which gives... DATA2 shape: (17, 16) x shape: (16,) y shape: (17,) So that looks OK. Turns out the error now comes at the line px, py = m(x, y). So perhaps I am doing the basemap step incorrectly? Traceback (most recent call last): File ./recontour_plot.py, line 83, inmodule px, py = m(x, y) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py, line 823, in __call__ return self.projtran(x,y,inverse=inverse) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py, line 241, in __call__ outx,outy = self._proj4(x, y, inverse=inverse) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py, line 193, in __call__ _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck) File _proj.pyx, line 56, in _proj.Proj._fwd (src/_proj.c:725) RuntimeError: Buffer lengths not the same Martin: You need a meshgrid x,y = np.meshgrid(x,y) just *before* (not after) px,py = m(x,y) so that x and y have the same shape as data2. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : jeffrey.s.whita...@noaa.gov 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://old.nabble.com/basemap-and-contouring-tp29697864p29699166.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap and contouring
On Mon, Sep 13, 2010 at 9:02 AM, mdekauwe mdeka...@gmail.com wrote: Hi, Well I tried... numrows = 17 numcols = 16 ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) print 'DATA2 shape:', data2.shape x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) print 'x shape:', x.shape print 'y shape:', y.shape px, py = m(x, y) which gives... DATA2 shape: (17, 16) x shape: (16,) y shape: (17,) So that looks OK. Turns out the error now comes at the line px, py = m(x, y). So perhaps I am doing the basemap step incorrectly? Traceback (most recent call last): File ./recontour_plot.py, line 83, in module px, py = m(x, y) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py, line 823, in __call__ return self.projtran(x,y,inverse=inverse) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py, line 241, in __call__ outx,outy = self._proj4(x, y, inverse=inverse) File /users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py, line 193, in __call__ _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck) File _proj.pyx, line 56, in _proj.Proj._fwd (src/_proj.c:725) RuntimeError: Buffer lengths not the same Martin, It would be more useful to see what are the shapes of px, py, X, and Y. Ben Root -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] contour plot in semi-circle domain
Hi! I want to use polar plot and write contour in semi-circle domain.But I can't do so. Here is a part of my code. - from pylab import * from scipy import * fig=figure(figsize=(10,10)) ax=fig.add_axes([0.1,0.1,0.8,0.8],polar=True) axis([0, pi, 0, 1]) show() I thought that axis([0,pi,0,1]) make the writing domain semi-circle, but complete circle was written as domain. Does anyone know how I should write? Many thanks, Kenshi -- View this message in context: http://old.nabble.com/contour-plot-in-semi-circle-domain-tp29699332p29699332.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Exclude colour from a colourbar
Hi, I am setting a colourbar where I explictly set the tick intervals. However I would like to exclude the colour black from this colourbar. The reason for this is I would like to overplot some contour lines in black, so would like to make them stand out. An example...where I would like to exclude black as the bottom colour of the colourbar, i.e. use the next level of gray. import numpy as np from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib as mpl data = np.random.randint(0,50,100*100).reshape(100, 100) m = Basemap(llcrnrlon=1.5, llcrnrlat=10.5, urcrnrlon=3.5, urcrnrlat=13.5, resolution='c', projection='cyl') fig = plt.figure(figsize=(8, 6)) ax = fig.add_axes([0.1, 0.1, 0.6, 0.7]) m.ax = ax colourmap = plt.cm.Greys_r ticks = [0, 10, 20, 30, 40, 50] norm = colors.BoundaryNorm(ticks, colourmap.N) im = m.imshow(data, colourmap, norm=norm, interpolation='nearest') pos = ax.get_position() l, b, w, h = pos.bounds cax = plt.axes([l+w+0.045, b, 0.05, h]) cbar = mpl.colorbar.ColorbarBase(cax, cmap=colourmap, norm=norm, ticks=ticks) plt.show() Many thanks, Martin -- View this message in context: http://old.nabble.com/Exclude-colour-from-a-colourbar-tp29699746p29699746.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap and contouring
On Mon, Sep 13, 2010 at 9:23 AM, Jeff Whitaker jsw...@fastmail.fm wrote: Martin: You need a meshgrid x,y = np.meshgrid(x,y) just *before* (not after) px,py = m(x,y) so that x and y have the same shape as data2. Yeah, my bad. That's what I get for responding *before* coffee this morning. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] problem with MPL+py2exe (wx app needs qt?)
Hello all, I'm trying to build an executable distribution of an app I'm working using py2exe. After a lot of googling, I found what it seems to be a good combination of parameters, but when I try to run the .exe, it fails. The .log file shows me that the module backend_qt4agg wasn't found: ImportError: No module named backend_qt4agg Also, using py2exe -x shows me that PyQt4 is being imported by matplotlib.pyplot. The thing is, this is a WxPython application. Why is pyplot importing pyqt?? How do I stop it? thanks -- 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. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib on Ubuntu 10.04 (64-bit)
I have tried to produce a very simple plot with my recent installation of matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) using the following code (taken from the matplotlib tutorial material). *import matplotlib import numpy import matplotlib.pyplot as plt print matplotlib.__version__ print numpy.__version__ plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show()* If I execute this in Windows 7 (64-bit) it works correctly. If I execute this in Windows Vista (32-bit) it works correctly. If I execute this in Ubuntu 10.04 64-bit the versions are printed out correctly and thus I believe that the packages are being imported; but, /no plot is produced!/ Why not? -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib on Ubuntu 10.04 (64-bit)
On 9/13/10 1:38 PM, Virgil Stokes wrote: I have tried to produce a very simple plot with my recent installation of matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) using the following code (taken from the matplotlib tutorial material). *import matplotlib import numpy import matplotlib.pyplot as plt print matplotlib.__version__ print numpy.__version__ plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show()* If I execute this in Windows 7 (64-bit) it works correctly. If I execute this in Windows Vista (32-bit) it works correctly. If I execute this in Ubuntu 10.04 64-bit the versions are printed out correctly and thus I believe that the packages are being imported; but, /no plot is produced!/ Why not? Virgil: Probably your default backend on Ubuntu is a non-gui backend (like Agg). See http://matplotlib.sourceforge.net/faq/installing_faq.html#backends for the definition of a backend and how to change the default. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : jeffrey.s.whita...@noaa.gov 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib on Ubuntu 10.04 (64-bit)
On Mon, Sep 13, 2010 at 2:38 PM, Virgil Stokes v...@it.uu.se wrote: I have tried to produce a very simple plot with my recent installation of matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) using the following code (taken from the matplotlib tutorial material). *import matplotlib import numpy import matplotlib.pyplot as plt print matplotlib.__version__ print numpy.__version__ plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show()* If I execute this in Windows 7 (64-bit) it works correctly. If I execute this in Windows Vista (32-bit) it works correctly. If I execute this in Ubuntu 10.04 64-bit the versions are printed out correctly and thus I believe that the packages are being imported; but, *no plot is produced!* Why not? Virgil, Did you build matplotlib from source? If so, then chances are that one or more backends were not built properly. This typically happens if you do not have all the build dependencies. Note, the build will not necessarily fail if some dependencies are missing because the core portions of matplotlib still build successfully. Ben Root -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Exclude colour from a colourbar
So far I have tried this... colourmap = cm.get_cmap(Greys_r) colourmap = colourmap._segmentdata # exclude 0, 0, 0...i.e. black from dictionary bvals = colourmap['blue'][1:] gvals = colourmap['green'][1:] rvals = colourmap['red'][1:] colourmap = { blue:bvals, green:gvals, red:rvals } colourmap = cm.set_cmap(colourmap) But it doesn't seem to like the set_cmap command colourmap = cm.set_cmap(colourmap) AttributeError: 'module' object has no attribute 'set_cmap' So I guess that isn't the way, nor I suspect is that all that elegant. Martin mdekauwe wrote: Hi, I am setting a colourbar where I explictly set the tick intervals. However I would like to exclude the colour black from this colourbar. The reason for this is I would like to overplot some contour lines in black, so would like to make them stand out. An example...where I would like to exclude black as the bottom colour of the colourbar, i.e. use the next level of gray. import numpy as np from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib as mpl data = np.random.randint(0,50,100*100).reshape(100, 100) m = Basemap(llcrnrlon=1.5, llcrnrlat=10.5, urcrnrlon=3.5, urcrnrlat=13.5, resolution='c', projection='cyl') fig = plt.figure(figsize=(8, 6)) ax = fig.add_axes([0.1, 0.1, 0.6, 0.7]) m.ax = ax colourmap = plt.cm.Greys_r ticks = [0, 10, 20, 30, 40, 50] norm = colors.BoundaryNorm(ticks, colourmap.N) im = m.imshow(data, colourmap, norm=norm, interpolation='nearest') pos = ax.get_position() l, b, w, h = pos.bounds cax = plt.axes([l+w+0.045, b, 0.05, h]) cbar = mpl.colorbar.ColorbarBase(cax, cmap=colourmap, norm=norm, ticks=ticks) plt.show() Many thanks, Martin -- View this message in context: http://old.nabble.com/Exclude-colour-from-a-colourbar-tp29699746p29702394.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] weird behaviour in x axis
On Sat, Sep 11, 2010 at 6:57 PM, freekk fre...@gmail.com wrote: Im trying to do a very simple x vs y plot. Where the x values range between 3247 and 3256 and y between 0 and 1. This data is stored in data.dat. I plot it using the code below, the resulting plot is shown in the first of the two plots below. Everything goes well except for the x axis, for some reason tickmarks from 0 up to 9 appear. At the far end of the axis my xmin is printed: 3.247e3. I started looking for the cause and it turns out that as long as my range in x is lower than 10, this happens. If I change the xlimits to xlim(3246,3256) I get the plot at the bottom of this page, everything is fine. But if I change this to for instance xlim(3246.01,3256) or xlim(3245, 3254.99) I get the same behaviour as in the first graph. Does any one have any experience with this/ know the reason for this happening? Thanks! from numpy import * from pylab import * datafile = mlab.load('./data.dat') xx=datafile[:,0] yy=datafile[:,1] plot(xx,yy,'black') xlim(3247,3256) ylim(0,1.2) show() http://old.nabble.com/file/p29687404/wrong.png http://old.nabble.com/file/p29687404/right.png What is happening isn't a bug, it is a feature, although it probably could be done a little bit better. When the range of values to display for ticks is fairly small compared to the size of the values, then matplotlib displays only the part that changes as a value relative to some constant offset. In your case, the constant offset is the +3.247e3 on the right hand side of the axis. This can also happen for the y-axis as well. This is similar to the idea of how matplotlib would display very large numbers like range(1e7, 10e7, 1e7) as 1 2 3 4 5 6 7 8 9 with a 1e7 at the end of the axis. I hope this makes sense. Ben Root -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] colorbar questions ...
On Sat, Sep 11, 2010 at 2:10 PM, Oz Nahum nahu...@gmail.com wrote: Hi Everyone again, So, with the weekend comes some time to think and I found an answer to another question of mine. I know now how to remove xticks in colorbar, and I also know how to customize the widths of the lines in the color bar. import matplotlib import numpy as np import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt from pylab import * matplotlib.rcParams['xtick.direction'] = 'out' matplotlib.rcParams['ytick.direction'] = 'out' delta = 0.025 x = np.arange(-3.0, 3.0, delta) y = np.arange(-2.0, 2.0, delta) X, Y = np.meshgrid(x, y) Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) # difference of Gaussians Z = 10.0 * (Z2 - Z1) # Create a simple contour plot with labels using default colors. The # inline argument to clabel will control whether the labels are draw # over the line segments of the contour, removing the lines beneath # the label plt.figure() CS = plt.contour(X, Y, Z) plt.clabel(CS, inline=1, fontsize=10,inlinespacing=50) a=plt.colorbar() ticks = a.ax.get_xticklines() lines = a.ax.get_ygridlines() children=a.ax.get_children() children=a.ax.get_children() children[4].set_linewidths([12,12,12,12,12,12]) for tick in ticks: setp(tick, []) plt.title('Customize colorbar') I hope someone finds that useful. And someone is still following my monologue, my question, how to remove the axes around the colorbar, or at least changed the to be non-visible, still stands... Thanks, Oz Oz, I agree, Colorbar isn't the most elegant of objects and is probably due for some improvements. I am sure there is probably a better way to do what you have done, but I am not familiar with it. Anyway, to get rid of the box around the colorbar, the colorbar object has a member attribute called outline which you can set_visible(False). a = plt.colorbar() a.outline.set_visible(False) Should do the trick for that part. I hope this helps! Ben Root -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] colorbar questions ...
On 9/11/2010 3:10 PM, Oz Nahum wrote: my question, how to remove the axes around the colorbar, or at least changed the to be non-visible, still stands... Did you resolve this? Alan Isaac -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib on Ubuntu 10.04 (64-bit)
On 2010-09-13 21:55, Benjamin Root wrote: On Mon, Sep 13, 2010 at 2:38 PM, Virgil Stokes v...@it.uu.se mailto:v...@it.uu.se wrote: I have tried to produce a very simple plot with my recent installation of matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) using the following code (taken from the matplotlib tutorial material). *import matplotlib import numpy import matplotlib.pyplot as plt print matplotlib.__version__ print numpy.__version__ plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show()* If I execute this in Windows 7 (64-bit) it works correctly. If I execute this in Windows Vista (32-bit) it works correctly. If I execute this in Ubuntu 10.04 64-bit the versions are printed out correctly and thus I believe that the packages are being imported; but, /no plot is produced!/ Why not? Virgil, Did you build matplotlib from source? I did try this and believe that it succeeded (saw no errors displayed during the build). If so, then chances are that one or more backends were not built properly. But, I do not understand what you mean here... This typically happens if you do not have all the build dependencies. And what can I do to correct this? Note, the build will not necessarily fail if some dependencies are missing because the core portions of matplotlib still build successfully. Sorry Ben, bu I do not understand what you mean here. Would you please explain how I can use some combination of the following (with Python 2.6 on Ubuntu 10.04 both 64-bit) to get a working matplotlib and numpy. * *python-numpy_1.4.1-4_amd64.deb* * *python-numpy_1.5.0-1ppa1_amd64.deb* * *numpy-1.5.0.tar.gz* and, * *matplotlib_0.99.3-1ubuntu1.debian.tar.gz* * *matplotlib_0.99.3.orig.tar.gz* * *matplotlib-1.0.0.tar.gz* This has become such a frustrating task that I would settle for vers. 0.99.3 of matplotlib and/or vers. 1.4.1-4 of numpy. I thought I understood Python and Ubuntu 10.04 enough to accomplish this task; but, obviously this was not the case. And I have looked at the FAQs and help given at matplotlib's homepage. --V -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with MPL+py2exe (wx app needs qt?)
Many thanks, that helper. After some more problems with scipy, I got a working EXE. PyQt4 is still in the library, though. Eating almost 15Mb... Now all I have to do is to find out how to remove it.. cheers Carlos On Mon, Sep 13, 2010 at 18:47, Goyo goyod...@gmail.com wrote: 2010/9/13 Carlos Grohmann carlos.grohm...@gmail.com: Hello all, I'm trying to build an executable distribution of an app I'm working using py2exe. After a lot of googling, I found what it seems to be a good combination of parameters, but when I try to run the .exe, it fails. The .log file shows me that the module backend_qt4agg wasn't found: ImportError: No module named backend_qt4agg Also, using py2exe -x shows me that PyQt4 is being imported by matplotlib.pyplot. The thing is, this is a WxPython application. Why is pyplot importing pyqt?? How do I stop it? Maybe it's specified in the matplotlib.rc. Make sure your intended backend is in use *before* you import pyplot: import matplotlib as mpl mpl.use('WXAgg') import pyplot as plt -- 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. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Exclude colour from a colourbar
The solution incase anyone has a similar issue... data = np.random.randint(0,50,100*100).reshape(100, 100) m = Basemap(llcrnrlon=1.5, llcrnrlat=10.5, urcrnrlon=3.5, urcrnrlat=13.5, resolution='c', projection='cyl') fig = plt.figure(figsize=(8, 6)) ax = fig.add_axes([0.1, 0.1, 0.6, 0.7]) m.ax = ax ticks = [0, 10, 20, 30, 40, 50] colours = cm.Greys_r(np.linspace(0.3, 1.0, 6)) colourmap = colors.ListedColormap(colours) norm = colors.BoundaryNorm(ticks, colourmap.N) im = m.imshow(data, cmap=colourmap, norm=norm, interpolation='nearest') pos = ax.get_position() l, b, w, h = pos.bounds cax = plt.axes([l+w+0.045, b, 0.05, h]) cbar = mpl.colorbar.ColorbarBase(cax, cmap=colourmap, norm=norm, ticks=ticks) plt.show() -- View this message in context: http://old.nabble.com/Exclude-colour-from-a-colourbar-tp29699746p29703615.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] weird behaviour in x axis
On 09/11/2010 11:12 AM, freekk wrote: Im trying to do a very simple x vs y plot. Where the x values range between 3247 and 3256 and y between 0 and 1. This data is stored in data.dat. I plot it using the code below, the resulting plot is shown in the first of the two plots below. Everything goes well except for the x axis, for some reason tickmarks from 0 up to 9 appear. At the far end of the axis my xmin is printed: 3.247e3. I started looking for the cause and it turns out that as long as my range in x is lower than 10, this happens. If I change the xlimits to xlim(3246,3256) I get the plot at the bottom of this page, everything is fine. But if I change this to for instance xlim(3246.01,3256) or xlim(3245, 3254.99) I get the same behaviour as in the first graph. Does any one have any experience with this/ know the reason for this happening? Thanks! from numpy import * from pylab import * datafile = mlab.load('./data.dat') xx=datafile[:,0] yy=datafile[:,1] plot(xx,yy,'black') xlim(3247,3256) ylim(0,1.2) with older mpl, try this: gca().xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) with 1.0 or later try the following instead: ticklabel_format(useOffset=False) Eric show() http://old.nabble.com/file/p29687404/wrong.png http://old.nabble.com/file/p29687404/right.png -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib on Ubuntu 10.04 (64-bit)
On 09/13/2010 12:08 PM, Virgil Stokes wrote: On 2010-09-13 21:55, Benjamin Root wrote: On Mon, Sep 13, 2010 at 2:38 PM, Virgil Stokes v...@it.uu.se mailto:v...@it.uu.se wrote: I have tried to produce a very simple plot with my recent installation of matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) using the following code (taken from the matplotlib tutorial material). *import matplotlib import numpy import matplotlib.pyplot as plt print matplotlib.__version__ print numpy.__version__ plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show()* If I execute this in Windows 7 (64-bit) it works correctly. If I execute this in Windows Vista (32-bit) it works correctly. If I execute this in Ubuntu 10.04 64-bit the versions are printed out correctly and thus I believe that the packages are being imported; but, /no plot is produced!/ Why not? Virgil, Did you build matplotlib from source? I did try this and believe that it succeeded (saw no errors displayed during the build). If so, then chances are that one or more backends were not built properly. But, I do not understand what you mean here... This typically happens if you do not have all the build dependencies. And what can I do to correct this? Note, the build will not necessarily fail if some dependencies are missing because the core portions of matplotlib still build successfully. Sorry Ben, bu I do not understand what you mean here. Would you please explain how I can use some combination of the following (with Python 2.6 on Ubuntu 10.04 both 64-bit) to get a working matplotlib and numpy. * *python-numpy_1.4.1-4_amd64.deb* * *python-numpy_1.5.0-1ppa1_amd64.deb* * *numpy-1.5.0.tar.gz* and, * *matplotlib_0.99.3-1ubuntu1.debian.tar.gz* * *matplotlib_0.99.3.orig.tar.gz* * *matplotlib-1.0.0.tar.gz* This has become such a frustrating task that I would settle for vers. 0.99.3 of matplotlib and/or vers. 1.4.1-4 of numpy. I thought I understood Python and Ubuntu 10.04 enough to accomplish this task; but, obviously this was not the case. And I have looked at the FAQs and help given at matplotlib's homepage. If you would like up-to-date versions of both numpy and matplotlib, then you can either find and install the *dev packages individually, or do something like this: sudo apt-get build-dep python-matplotlib sudo apt-get remove python Now untar your numpy, go in, build and install: setup.py build sudo setup.py install And last, do the same for matplotlib, preferably with a checkout from svn. Some bugs have been fixed since the last release. Before all of this, you might do well to uninstall whatever versions or parts of numpy and matplotlib had been installed via your previous efforts. The point of the first apt-get is to install things like freetype and the gui toolkits. The only problem is that this also installs an old version of numpy, hence the second apt-get command. The good news is that once you get over the hump of having the dependencies installed, subsequent updates and compilations of numpy and matplotlib are easy. It is usually advisable to delete the build directory, since setup.py is not very smart with respect to knowing what needs to be recompiled. Sometimes it is also necessary to clean out the old version from its installation location. See attached script for an example of mpl uninstallation. Eric #!/bin/sh sudo rm -rf /usr/local/lib/python2.6/dist-packages/matplotlib* sudo rm -rf /usr/local/lib/python2.6/dist-packages/pylab* sudo rm -rf /usr/local/lib/python2.6/dist-packages/mpl_toolkits/mplot3d sudo rm -rf /usr/local/lib/python2.6/dist-packages/mpl_toolkits/axes_grid sudo rm -rf /usr/local/lib/python2.6/dist-packages/mpl_toolkits/axes_grid1 sudo rm -rf /usr/local/lib/python2.6/dist-packages/mpl_toolkits/axisartist sudo rm /usr/local/lib/python2.6/dist-packages/mpl_toolkits/*.py -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] contour plot in semi-circle domain
On Tue, Sep 14, 2010 at 12:09 AM, Kenshi hibino hib...@kugi.kyoto-u.ac.jp wrote: I thought that axis([0,pi,0,1]) make the writing domain semi-circle, but complete circle was written as domain. Does anyone know how I should write? With polar projection, it is not possible to make semi-circle domain. You need to make a custom projection (http://matplotlib.sourceforge.net/devel/add_new_projection.html). But it would not be easy for a normal user. Another option is to use mpl_toolkits.axisartist (distributed with mpl 1.0). However, learning curve of the axisartist is also steep. You may play around with the last figure in the example below. http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html Regards, -JJ -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib on Ubuntu 10.04 (64-bit)
On Mon, Sep 13, 2010 at 5:55 PM, Eric Firing efir...@hawaii.edu wrote: On 09/13/2010 12:08 PM, Virgil Stokes wrote: On 2010-09-13 21:55, Benjamin Root wrote: On Mon, Sep 13, 2010 at 2:38 PM, Virgil Stokes v...@it.uu.se mailto:v...@it.uu.se wrote: I have tried to produce a very simple plot with my recent installation of matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) using the following code (taken from the matplotlib tutorial material). *import matplotlib import numpy import matplotlib.pyplot as plt print matplotlib.__version__ print numpy.__version__ plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show()* If I execute this in Windows 7 (64-bit) it works correctly. If I execute this in Windows Vista (32-bit) it works correctly. If I execute this in Ubuntu 10.04 64-bit the versions are printed out correctly and thus I believe that the packages are being imported; but, /no plot is produced!/ Why not? Virgil, Did you build matplotlib from source? I did try this and believe that it succeeded (saw no errors displayed during the build). If so, then chances are that one or more backends were not built properly. But, I do not understand what you mean here... This typically happens if you do not have all the build dependencies. And what can I do to correct this? Note, the build will not necessarily fail if some dependencies are missing because the core portions of matplotlib still build successfully. Sorry Ben, bu I do not understand what you mean here. Would you please explain how I can use some combination of the following (with Python 2.6 on Ubuntu 10.04 both 64-bit) to get a working matplotlib and numpy. * *python-numpy_1.4.1-4_amd64.deb* * *python-numpy_1.5.0-1ppa1_amd64.deb* * *numpy-1.5.0.tar.gz* and, * *matplotlib_0.99.3-1ubuntu1.debian.tar.gz* * *matplotlib_0.99.3.orig.tar.gz* * *matplotlib-1.0.0.tar.gz* This has become such a frustrating task that I would settle for vers. 0.99.3 of matplotlib and/or vers. 1.4.1-4 of numpy. I thought I understood Python and Ubuntu 10.04 enough to accomplish this task; but, obviously this was not the case. And I have looked at the FAQs and help given at matplotlib's homepage. If you would like up-to-date versions of both numpy and matplotlib, then you can either find and install the *dev packages individually, or do something like this: sudo apt-get build-dep python-matplotlib sudo apt-get remove python Now untar your numpy, go in, build and install: setup.py build sudo setup.py install And last, do the same for matplotlib, preferably with a checkout from svn. Some bugs have been fixed since the last release. Before all of this, you might do well to uninstall whatever versions or parts of numpy and matplotlib had been installed via your previous efforts. The point of the first apt-get is to install things like freetype and the gui toolkits. The only problem is that this also installs an old version of numpy, hence the second apt-get command. The good news is that once you get over the hump of having the dependencies installed, subsequent updates and compilations of numpy and matplotlib are easy. It is usually advisable to delete the build directory, since setup.py is not very smart with respect to knowing what needs to be recompiled. Sometimes it is also necessary to clean out the old version from its installation location. See attached script for an example of mpl uninstallation. Eric Eric, I keep on forgetting about that useful build-dep command. Maybe it might be a good idea to include some of this information in the documentation as a tip of some sort? I should also see if yum for RedHat-based systems also have something similar. Finding all the dependencies can be a little tedious at times and I often over-do it. Ben Root -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Fwd: Matplotlib-users Digest, Vol 52, Issue 26
Virgil The scheme illustrated below actually does work. Message: 5 Date: Mon, 13 Sep 2010 12:55:43 -1000 From: Eric Firing efir...@hawaii.edu Subject: Re: [Matplotlib-users] matplotlib on Ubuntu 10.04 (64-bit) To: matplotlib-users@lists.sourceforge.net Message-ID: 4c8eabef.30...@hawaii.edu Content-Type: text/plain; charset=iso-8859-1 On 09/13/2010 12:08 PM, Virgil Stokes wrote: On 2010-09-13 21:55, Benjamin Root wrote: On Mon, Sep 13, 2010 at 2:38 PM, Virgil Stokes v...@it.uu.se mailto:v...@it.uu.se wrote: If you would like up-to-date versions of both numpy and matplotlib, then you can either find and install the *dev packages individually, or do something like this: sudo apt-get build-dep python-matplotlib sudo apt-get remove python ^^^ No, that is probably supposed to be sudo apt-get remove numpy Now untar your numpy, go in, build and install: setup.py build sudo setup.py install And last, do the same for matplotlib, preferably with a checkout from svn. Some bugs have been fixed since the last release. Before all of this, you might do well to uninstall whatever versions or parts of numpy and matplotlib had been installed via your previous efforts. [snip] Eric You can tell whether you have any leftover pieces of numpy or matplotlib from the *.deb files by looking in /usr/lib/python2.6/dist-packages for numpy or matplotlib. Eric, the script was scrubbed. Does it land somewhere else? Jules (Jules Hummon/Univ. Hawaii/physical oceanography) -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users