You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(33) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(7) |
Feb
(44) |
Mar
(51) |
Apr
(43) |
May
(43) |
Jun
(36) |
Jul
(61) |
Aug
(44) |
Sep
(25) |
Oct
(82) |
Nov
(97) |
Dec
(47) |
2005 |
Jan
(77) |
Feb
(143) |
Mar
(42) |
Apr
(31) |
May
(93) |
Jun
(93) |
Jul
(35) |
Aug
(78) |
Sep
(56) |
Oct
(44) |
Nov
(72) |
Dec
(75) |
2006 |
Jan
(116) |
Feb
(99) |
Mar
(181) |
Apr
(171) |
May
(112) |
Jun
(86) |
Jul
(91) |
Aug
(111) |
Sep
(77) |
Oct
(72) |
Nov
(57) |
Dec
(51) |
2007 |
Jan
(64) |
Feb
(116) |
Mar
(70) |
Apr
(74) |
May
(53) |
Jun
(40) |
Jul
(519) |
Aug
(151) |
Sep
(132) |
Oct
(74) |
Nov
(282) |
Dec
(190) |
2008 |
Jan
(141) |
Feb
(67) |
Mar
(69) |
Apr
(96) |
May
(227) |
Jun
(404) |
Jul
(399) |
Aug
(96) |
Sep
(120) |
Oct
(205) |
Nov
(126) |
Dec
(261) |
2009 |
Jan
(136) |
Feb
(136) |
Mar
(119) |
Apr
(124) |
May
(155) |
Jun
(98) |
Jul
(136) |
Aug
(292) |
Sep
(174) |
Oct
(126) |
Nov
(126) |
Dec
(79) |
2010 |
Jan
(109) |
Feb
(83) |
Mar
(139) |
Apr
(91) |
May
(79) |
Jun
(164) |
Jul
(184) |
Aug
(146) |
Sep
(163) |
Oct
(128) |
Nov
(70) |
Dec
(73) |
2011 |
Jan
(235) |
Feb
(165) |
Mar
(147) |
Apr
(86) |
May
(74) |
Jun
(118) |
Jul
(65) |
Aug
(75) |
Sep
(162) |
Oct
(94) |
Nov
(48) |
Dec
(44) |
2012 |
Jan
(49) |
Feb
(40) |
Mar
(88) |
Apr
(35) |
May
(52) |
Jun
(69) |
Jul
(90) |
Aug
(123) |
Sep
(112) |
Oct
(120) |
Nov
(105) |
Dec
(116) |
2013 |
Jan
(76) |
Feb
(26) |
Mar
(78) |
Apr
(43) |
May
(61) |
Jun
(53) |
Jul
(147) |
Aug
(85) |
Sep
(83) |
Oct
(122) |
Nov
(18) |
Dec
(27) |
2014 |
Jan
(58) |
Feb
(25) |
Mar
(49) |
Apr
(17) |
May
(29) |
Jun
(39) |
Jul
(53) |
Aug
(52) |
Sep
(35) |
Oct
(47) |
Nov
(110) |
Dec
(27) |
2015 |
Jan
(50) |
Feb
(93) |
Mar
(96) |
Apr
(30) |
May
(55) |
Jun
(83) |
Jul
(44) |
Aug
(8) |
Sep
(5) |
Oct
|
Nov
(1) |
Dec
(1) |
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(1) |
Oct
(3) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
(7) |
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
(8) |
2
|
3
|
4
|
5
(15) |
6
(4) |
7
(2) |
8
(1) |
9
(1) |
10
(6) |
11
(1) |
12
(1) |
13
(3) |
14
(2) |
15
|
16
|
17
|
18
|
19
(1) |
20
|
21
(3) |
22
(2) |
23
|
24
|
25
|
26
|
27
(1) |
28
(3) |
29
|
30
(3) |
|
|
From: James E. <jre...@ea...> - 2006-11-30 16:18:44
|
All, I just submitted an update to backend_qt.py and backend_qt4.py. Both updates remove the 'mainloop' flag from the 'show' function as it is now handled automatically. Essentially the qt event-loop will only be started by matplotlib if matplotlib was the one to create the qApp, if not then it is up to the creator of the Qt qApp to start the event-loop when they are ready for it. This allows for applications with embedded Qt event loops to work with matplotlib. I have run some test cases in a few different python environments (including the vanilla python) and all seem to be working. I have not, however tested this in the iPython environment (although I don't think that iPython uses Qt, does it?). Any feedback would be appreciated. --James Evans |
From: Jeff W. <js...@fa...> - 2006-11-30 15:57:49
|
Aalok kapoor wrote: > Hi all, > > I am using matplotlib-0.87.7, Basemap-0.9.3, Numpy-1.1 and agg backend. > I am facing memory leak problems after running following script - > > > import os, sys, time > import cStringIO > import Image > import matplotlib > matplotlib.use('Agg') > > import matplotlib.pylab as p > import matplotlib.numerix as nx > from matplotlib.toolkits.basemap import Basemap > > def get_image_bytes(width_fig, height_fig, str_img): > """Returns the bytes representing the image generated > > The createImage method should be called before calling this method. > > :Returns: > Byte data. > """ > # Get the actual image data > f = cStringIO.StringIO() > dims = (width_fig, height_fig) > im = Image.fromstring("RGB", dims, str_img) > im.save(f, "JPEG") > return f.getvalue() > > def report_memory(i): > pid = os.getpid() > a2 = os.popen('ps -p %d -o rss,vsz,%%mem' % pid).readlines() > print i, ' ', a2[1], > return int(a2[1].split()[1]) > > > > # take a memory snapshot on indStart and compare it with indEnd > indStart, indEnd = 30, 150 > print ' rss vsz %mem' > for i in range(indEnd): > p.figure(figsize=(float(640)/80.0,float(480)/80.0), > facecolor='w', edgecolor='w') > p.axes([0.0, 0.0, 1.0, 1.0]) > map1 = Basemap(projection='cyl', lat_0=50, lon_0=-100, > area_thresh=1000.) > # draw coastlines, country boundaries, fill continents. > map1.drawcoastlines(linewidth=.5) > map1.drawcountries() > map1.fillcontinents(color="#CEFFCE") > # draw the edge of the map projection region (the projection limb) > map1.drawmapboundary() > # compute the native map projection coordinates for cities. > lats, lons = ([18.728], [20.890]) > x,y = map1(lons,lats) > # plot filled circles at the locations of the cities. > map1.plot(x,y,'bo') > canvas = p.get_current_fig_manager().canvas > agg = canvas.switch_backends \ > (matplotlib.backends.backend_agg.FigureCanvasAgg) > agg.draw() # Takes ~.9 seconds > # get the image data > str_img = agg.tostring_rgb() > width_fig, height_fig = map(int, agg.figure.bbox.get_bounds()[2:]) > p.cla() > p.close() > bytes = get_image_bytes(width_fig, height_fig, str_img) > > > val = report_memory(i) > # wait a few cycles for memory usage to stabilize > if i==indStart: start = val > > end = val > print 'Average memory consumed per loop: %1.4fk bytes' % \ > ((end-start)/float(indEnd-indStart)) > > > > > Here is the O/P > > $python memory_leak_map.py > rss vsz %mem > 0 47272 50632 9.7 > 1 74412 77700 15.3 > 2 93960 97380 19.3 > 3 113308 116776 23.3 > 4 132824 136416 27.3 > 5 152352 155828 31.3 > 6 171860 175216 35.3 > 7 191372 194868 39.3 > 8 210872 214248 43.3 > 9 230336 233916 47.3 > 10 249732 253284 51.3 > 11 269252 272692 55.3 > 12 288680 292336 59.3 > 13 308108 311724 63.2 > 14 305160 331112 62.6 > 15 301096 350764 61.8 > 16 304884 370160 62.6 > 17 298276 389804 61.2 > 18 305876 409184 62.8 > 19 298316 428596 61.2 > 20 307856 448224 63.2 > 21 308004 467640 63.2 > 22 308844 487016 63.4 > 23 306260 506656 62.9 > 24 300612 526052 61.7 > Traceback (most recent call last): > File "memory_leak_map.py", line 41, in ? > area_thresh=1000.) > File > "/usr/local/lib/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py", > line 815, in __init__ > self.riversegs = segments+segments2+segments3 > MemoryError > Killed: 9 > > > Can someone please help me out solving this problem? > > > Thanks > -Aalok > Aaolk: All your plots use the same map projection, yet you are initializing a new Basemap instance every time through the loop. Try moving the line map1 = Basemap(projection='cyl', lat_0=50, lon_0=-100, area_thresh=1000.) outside the loop. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: Aalok k. <aal...@ya...> - 2006-11-30 12:05:24
|
Hi all, I am using matplotlib-0.87.7, Basemap-0.9.3, Numpy-1.1 and agg backend. I am facing memory leak problems after running following script - import os, sys, time import cStringIO import Image import matplotlib matplotlib.use('Agg') import matplotlib.pylab as p import matplotlib.numerix as nx from matplotlib.toolkits.basemap import Basemap def get_image_bytes(width_fig, height_fig, str_img): """Returns the bytes representing the image generated The createImage method should be called before calling this method. :Returns: Byte data. """ # Get the actual image data f = cStringIO.StringIO() dims = (width_fig, height_fig) im = Image.fromstring("RGB", dims, str_img) im.save(f, "JPEG") return f.getvalue() def report_memory(i): pid = os.getpid() a2 = os.popen('ps -p %d -o rss,vsz,%%mem' % pid).readlines() print i, ' ', a2[1], return int(a2[1].split()[1]) # take a memory snapshot on indStart and compare it with indEnd indStart, indEnd = 30, 150 print ' rss vsz %mem' for i in range(indEnd): p.figure(figsize=(float(640)/80.0,float(480)/80.0), facecolor='w', edgecolor='w') p.axes([0.0, 0.0, 1.0, 1.0]) map1 = Basemap(projection='cyl', lat_0=50, lon_0=-100, area_thresh=1000.) # draw coastlines, country boundaries, fill continents. map1.drawcoastlines(linewidth=.5) map1.drawcountries() map1.fillcontinents(color="#CEFFCE") # draw the edge of the map projection region (the projection limb) map1.drawmapboundary() # compute the native map projection coordinates for cities. lats, lons = ([18.728], [20.890]) x,y = map1(lons,lats) # plot filled circles at the locations of the cities. map1.plot(x,y,'bo') canvas = p.get_current_fig_manager().canvas agg = canvas.switch_backends \ (matplotlib.backends.backend_agg.FigureCanvasAgg) agg.draw() # Takes ~.9 seconds # get the image data str_img = agg.tostring_rgb() width_fig, height_fig = map(int, agg.figure.bbox.get_bounds()[2:]) p.cla() p.close() bytes = get_image_bytes(width_fig, height_fig, str_img) val = report_memory(i) # wait a few cycles for memory usage to stabilize if i==indStart: start = val end = val print 'Average memory consumed per loop: %1.4fk bytes' % \ ((end-start)/float(indEnd-indStart)) Here is the O/P $python memory_leak_map.py rss vsz %mem 0 47272 50632 9.7 1 74412 77700 15.3 2 93960 97380 19.3 3 113308 116776 23.3 4 132824 136416 27.3 5 152352 155828 31.3 6 171860 175216 35.3 7 191372 194868 39.3 8 210872 214248 43.3 9 230336 233916 47.3 10 249732 253284 51.3 11 269252 272692 55.3 12 288680 292336 59.3 13 308108 311724 63.2 14 305160 331112 62.6 15 301096 350764 61.8 16 304884 370160 62.6 17 298276 389804 61.2 18 305876 409184 62.8 19 298316 428596 61.2 20 307856 448224 63.2 21 308004 467640 63.2 22 308844 487016 63.4 23 306260 506656 62.9 24 300612 526052 61.7 Traceback (most recent call last): File "memory_leak_map.py", line 41, in ? area_thresh=1000.) File "/usr/local/lib/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py", line 815, in __init__ self.riversegs = segments+segments2+segments3 MemoryError Killed: 9 Can someone please help me out solving this problem? Thanks -Aalok --------------------------------- Find out what India is talking about on - Yahoo! Answers India Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW |
From: JIM M. <ji...@ji...> - 2006-11-28 21:15:46
|
Hi Eric, Thanks for your reply. It made me realise a few things.... > > But when I add a colorbar it goes wrong. The colorbar is labelled with > > the log of the values, rather > > than values, and the colour only fills the top third of the colorbar. > > In the absence of additional kwargs, colorbar uses norm.vmin and > norm.vmax to determine the limits of the colorbar, and it uses a default > formatter. It has no way of knowing that you have taken the log of your > original values. Yes of course there is in inconsistency in my LogNorm class. norm.vmax will return the log of the maximum, when logically it should return the max of the actual maximum. I've modified my example to take this into account. see attached (and updated version online). > Colorbar will need some kwargs, at the very least. The "format" kwarg, > for example, can be used to pass in a Formatter instance so that a label > is 10^-3 instead of -3. Ah I'd not discovered Formatters yet. But this does give a good solution. If I instead do a pcolor of the log of my data, and then use a FormatStrFormatter as you surgested: pcolor(X,Y,log10(Z1),shading='flat') colorbar(format=FormatStrFormatter('$10^{%d}$')) I get exactly what I want :-) Its not the most intuitive way to do it, but it works and I can't see any major drawbacks. > I am not sure why only the top is colored in your example--it might be a > bug or it might be an indication that additional kwargs are needed. I > am reasonably sure there is a simple solution, but I can't look at it > any more right now--maybe I can get back to it this evening. I'm pretty sure the reason only the top was coloured is to do in the inconsistency I described above. Once I fixed that the colorbar is fine except that it is not on a log scale. But of course it can't know that it is suppost to be on a log scale! I tried to do: gca().axes[1].set_ylim((1e-5,1)) gca().axes[1].set_yscale('log') but that doesn't work. I get a load of errors : exceptions.ValueError Traceback (most recent call last) /usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py in expose_event(self, widget, event) 282 x, y, w, h = self.allocation 283 self._pixmap_prepare (w, h) --> 284 self._render_figure(self._pixmap, w, h) 285 self._need_redraw = False 286 /usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py in _render_figure(self, pixmap, width, height) 71 def _render_figure(self, pixmap, width, height): 72 if DEBUG: print 'FigureCanvasGTKAgg.render_figure' ---> 73 FigureCanvasAgg.draw(self) 74 if DEBUG: print 'FigureCanvasGTKAgg.render_figure pixmap', pixmap 75 #agg_to_gtk_drawable(pixmap, self.renderer._renderer, None) /usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py in draw(self) 390 391 renderer = self.get_renderer() --> 392 self.figure.draw(renderer) 393 394 def get_renderer(self): /usr/lib/python2.4/site-packages/matplotlib/figure.py in draw(self, renderer) 542 543 # render the axes --> 544 for a in self.axes: a.draw(renderer) 545 546 # render the figure text /usr/lib/python2.4/site-packages/matplotlib/axes.py in draw(self, renderer, inframe) 1061 1062 for zorder, i, a in dsu: -> 1063 a.draw(renderer) 1064 1065 self.transData.thaw() # release the lazy objects /usr/lib/python2.4/site-packages/matplotlib/patches.py in draw(self, renderer) 163 164 verts = self.get_verts() --> 165 tverts = self._transform.seq_xy_tups(verts) 166 167 renderer.draw_polygon(gc, rgbFace, tverts) ValueError: Domain error on nonlinear Transformation::seq_xy_tups operator()(thisx, thisy) As for how to solve the problem properly. Matlab allows one to set to caxis scale to log. Maybe colorbar could detect that the norm instance was an instance of LogNorm and scale the yaxis logarithmicly. Or would it be better to put a scale={'log','linear'} kwarg into colorbar()? Thanks again for your help. cheers JIM --- |
From: Eric F. <ef...@ha...> - 2006-11-28 19:04:12
|
JIM MacDonald wrote: > Hi, > > I'm trying to do a pcolor plot with a log normalised colour scale. > Following advice from past posts > to this list I specialised the matplotlib.colors.normalize class, and > passed an instance of that to > pcolor using the norm kwarg. > > This works fine :-) > > But when I add a colorbar it goes wrong. The colorbar is labelled with > the log of the values, rather > than values, and the colour only fills the top third of the colorbar. In the absence of additional kwargs, colorbar uses norm.vmin and norm.vmax to determine the limits of the colorbar, and it uses a default formatter. It has no way of knowing that you have taken the log of your original values. > > Am I doing something wrong, or is this a problem with the colorbar? Colorbar will need some kwargs, at the very least. The "format" kwarg, for example, can be used to pass in a Formatter instance so that a label is 10^-3 instead of -3. I am not sure why only the top is colored in your example--it might be a bug or it might be an indication that additional kwargs are needed. I am reasonably sure there is a simple solution, but I can't look at it any more right now--maybe I can get back to it this evening. Eric > Any help would be much > appreciated. I realise that as a work around I could do a pcolor of > the log of my data and manually > relabel the colorbar, but it would be nice to do it properly. > > I've attached an png of the output and the code. Just in case the > attachments get stripped they are > also available to download from: > http://jimmacdonald.co.uk/pcolor_log.png > http://jimmacdonald.co.uk/pcolor_log.py > > I'm running the svn version (r2898--- lastest as of yesterday) with > numpy-1.0_rc1 on gentoo. > > Keep up the good work! > > Cheers, > > JIM |
From: JIM M. <ji...@ji...> - 2006-11-28 09:47:47
|
Hi, I'm trying to do a pcolor plot with a log normalised colour scale. Following advice from past posts to this list I specialised the matplotlib.colors.normalize class, and passed an instance of that to pcolor using the norm kwarg. This works fine :-) But when I add a colorbar it goes wrong. The colorbar is labelled with the log of the values, rather than values, and the colour only fills the top third of the colorbar. Am I doing something wrong, or is this a problem with the colorbar? Any help would be much appreciated. I realise that as a work around I could do a pcolor of the log of my data and manually relabel the colorbar, but it would be nice to do it properly. I've attached an png of the output and the code. Just in case the attachments get stripped they are also available to download from: http://jimmacdonald.co.uk/pcolor_log.png http://jimmacdonald.co.uk/pcolor_log.py I'm running the svn version (r2898--- lastest as of yesterday) with numpy-1.0_rc1 on gentoo. Keep up the good work! Cheers, JIM --- |
From: Michael H. <mic...@bc...> - 2006-11-27 23:28:33
|
hello matplotlib-community, the x,y,z labels of Axes3D are not oriented in the same azimuth/elevation as the plot is and often interferes with the ticks. is this a known problem and does anybody know how to circumvent this? thanks a lot! michael -- Michael Held, Dipl.-Inf. ETH Zurich Institute of Biochemistry HPM E17, Schafmattstrasse 18 8093 Zuerich, Switzerland Phone: +41 44 632 3148, Fax: +41 44 632 1269 mic...@bc... |
From: Jeff W. <js...@fa...> - 2006-11-22 13:06:52
|
Aalok kapoor wrote: > Hi all, > > I have tried to use basemap to plot world map and successfully plotted > points on it by giving lists of latitudes and longitudes. One problem > i have is i want to give different colors for different countries, > i.e. regarding population. For ex. for range 2-20 -- green. 20-100 -- > red.. etc.. > How can i give colors to different countries according to data I pass > to it? please help me in knowing whether it is possible or not. > > Thanks in advance, > -Aalok > > Aaolok: If you have access to the individual country polygons by ccountry name, it's easy. Unfortunately, the built-in country database is not accessible that way. Googling 'country shapefiles' came up with this. http://www.cipotato.org/DIVA/data/MoreData.htm Using that shapefile is was pretty easy to adapt the 'fillstates.py' example to fill the country polygons. Here each country is filled with a random color, so you can just replace the random number with a value from your dataset. import pylab as p from matplotlib.toolkits.basemap import Basemap as Basemap from matplotlib.colors import rgb2hex import random # Miller projection world map. m = Basemap(llcrnrlon=-180,llcrnrlat=-90,urcrnrlon=180,urcrnrlat=90, projection='mill') # draw country boundaries. # data from http://www.cipotato.org/DIVA/data/MoreData.htm shp_info = m.readshapefile('world_adm0','countries',drawbounds=True) # choose a color for each state based on population density. colors={} countrynames=[] cmap = p.cm.jet # use 'jet' colormap vmin = 0; vmax = 1000000 # set range of population for shapedict in m.countries_info: countryname = shapedict['NAME'] # set population to a random number # (replace with a real value) pop = float(random.randint(0,1000000)) # calling colormap with value between 0 and 1 returns # rgba value. Invert color range (hot colors are high # population), take sqrt root to spread out colors more. colors[countryname] = cmap(1.-p.sqrt((pop-vmin)/(vmax-vmin)))[:3] countrynames.append(countryname) # cycle through country names, color each one. for nshape,seg in enumerate(m.countries): xx,yy = zip(*seg) color = rgb2hex(colors[countrynames[nshape]]) p.fill(xx,yy,color,edgecolor=color) # draw meridians and parallels. m.drawparallels(p.arange(-90,91,30),labels=[1,0,0,0]) m.drawmeridians(p.arange(-180,181,60),labels=[0,0,0,1]) p.title('Filling Country Polygons') p.show() HTH, -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 |
From: Aalok k. <aal...@ya...> - 2006-11-22 04:39:46
|
Hi all, I have tried to use basemap to plot world map and successfully plotted points on it by giving lists of latitudes and longitudes. One problem i have is i want to give different colors for different countries, i.e. regarding population. For ex. for range 2-20 -- green. 20-100 -- red.. etc.. How can i give colors to different countries according to data I pass to it? please help me in knowing whether it is possible or not. Thanks in advance, -Aalok --------------------------------- Find out what India is talking about on - Yahoo! Answers India Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW |
From: John H. <jdh...@ac...> - 2006-11-21 18:29:35
|
>>>>> "Joachim" == Joachim Dahl <dah...@gm...> writes: Joachim> this doesn't: matshow(matrix([[1.0,2.0],[3.0,4.0]]) but Joachim> this does Joachim> matshow(pylab.array(matrix([[1.0,2.0],[3.0,4.0]]) These should be considered bugs -- we should do an asarray anywhere we are expecting an array input. I fixed matshow in svn -- let us know if you find others, or send a patch. They are easy to fix. JDH |
From: Joachim D. <dah...@gm...> - 2006-11-21 18:18:05
|
On 11/21/06, Andrew Straw <str...@as...> wrote: > > Joachim Dahl wrote: > > Dear developers, > > > > I am a happy user of Matplotlib, which is a wonderful library - thank > > you! > > > > Would it possible to support the SciPy Array interface in more places > > to make > > Matplotlib less dependent on Numpy/numarray? > I guess you mean numpy where you say scipy and Numeric where you say > numpy? Probably - I wouldn't be the first to get the names wrong... ;) In that case, the answer is yes: > > numpy.asarray( you_array_interface_supporting_object_here ) > > I know you can convert arrays, but it would nice not to have to. E.g., this works: imshow(matrix([[1.0,2.0],[3.0,4.0]]), this doesn't: matshow(matrix([[1.0,2.0],[3.0,4.0]]) but this does matshow(pylab.array(matrix([[1.0,2.0],[3.0,4.0]]) |
From: Andrew S. <str...@as...> - 2006-11-21 18:01:54
|
Joachim Dahl wrote: > Dear developers, > > I am a happy user of Matplotlib, which is a wonderful library - thank > you! > > Would it possible to support the SciPy Array interface in more places > to make > Matplotlib less dependent on Numpy/numarray? I guess you mean numpy where you say scipy and Numeric where you say numpy? In that case, the answer is yes: numpy.asarray( you_array_interface_supporting_object_here ) |
From: Joachim D. <dah...@gm...> - 2006-11-19 09:48:25
|
Dear developers, I am a happy user of Matplotlib, which is a wonderful library - thank you! Would it possible to support the SciPy Array interface in more places to make Matplotlib less dependent on Numpy/numarray? In Ubuntu Edgy's version of Matplotlib it's possible to use CVXOPT matrices in some places, but not in others: >>> from cvxopt.base import matrix >>> import pylab, numpy >>> pylab.imshow(matrix([[1.0,2.0],[3.0,4.0]])) <matplotlib.image.AxesImage instance at 0xb5d560ac> >>> pylab.matshow(matrix([[1.0,2.0],[3.0,4.0]])) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 1431, in matshow w,h = figaspect(arr) File "/usr/lib/python2.4/site-packages/matplotlib/figure.py", line 932, in figaspect arr_ratio = float(arg) TypeError: float() argument must be a string or a number -Joachim |
From: John H. <jdh...@ac...> - 2006-11-14 14:30:59
|
>>>>> "Norbert" == Norbert Nemec <Nor...@gm...> writes: Norbert> Thanks for clearing this up. Coding with three different Norbert> numeric libraries in mind certainly is tricky... :-( This is another good example of the benefits of duck typing -- using "iterable" rather than "hasattar" checks for the interface rather than the implementation. JDH |
From: Norbert N. <Nor...@gm...> - 2006-11-14 11:26:50
|
Thanks for clearing this up. Coding with three different numeric libraries in mind certainly is tricky... :-( Eric Firing wrote: > This is fixed now in SVN. The problem was that Numeric arrays lack a > "len" attribute, and "hasattr(xmin, 'len')" was being used to find out > whether xmin is a scalar or a length-2 array (xmin, xmax). The > solution is to do the test with "iterable(xmin)" instead. The bug was > introduced in 2782. > > Eric > > Edin Salkovic wrote: >> I'm posting this because of the other thread Darren started. >> >> I managed to reinstall python (and the modules I use) several days ago >> and tried again to run matplotlib with Numeric as the default backend, >> but got the same error (the same error Darren is getting). Then I >> installed numpy, and everything was fixed :) >> >> Best, >> Edin >> >> On 10/22/06, Edin Salkovic <edi...@gm...> wrote: >>> Unfortunately, I forgot to do it :( >>> >>> Then, just after sending the message to the list, it sprang to my >>> mind. To make it worse, I then mistakenly entered: >>> rm -Rf /path/to/site-packages >>> >>> no matplotlib at the end, and hit enter. >>> >>> There goes my beautiful Python install. :'( >>> >>> Is there some switch to setup.py to make it remove the mpl dir or does >>> one allways have to do it by hand? >>> >>> Cheers, >>> Edin >>> >>> On 10/22/06, Darren Dale <dd...@co...> wrote: >>>> Did you try deleting your old mpl directory from site-packages, >>>> remove the >>>> build directory from you mpl sources, and rebuild from scratch? >>>> >>>> >>>> >>>> On Sunday 22 October 2006 6:59 am, Edin Salkovic wrote: >>>>> Hi, >>>>> >>>>> I built and installed the latest matplotlib from SVN. >>>>> >>>>> When I type: >>>>>>>> from pylab import * >>>>>>>> plot([1,2,3]) >>>>> I get: >>>>> >>>>> Traceback (most recent call last): >>>>> File "<stdin>", line 1, in ? >>>>> File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line >>>>> 2027, in plot >>>>> ret = gca().plot(*args, **kwargs) >>>>> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line >>>>> 2131, in plot self.autoscale_view(scalex=scalex, scaley=scaley) >>>>> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line >>>>> 985, in autoscale_view >>>>> self.set_xlim(XL) >>>>> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line >>>>> 1227, in set_xlim >>>>> self.viewLim.intervalx().set_bounds(xmin, xmax) >>>>> TypeError: only length-1 arrays can be converted to Python scalars. >>>>> >>>>> I'm using Numeric as numerix. I'm on a Ubuntu box with python 2.4. >>>>> >>>>> ------------------------------------------------------------------------- >>>>> >>>>> Using Tomcat but need to do more? Need to support web services, >>>>> security? >>>>> Get stuff done quickly with pre-integrated technology to make your >>>>> job >>>>> easier Download IBM WebSphere Application Server v.1.0.1 based on >>>>> Apache >>>>> Geronimo >>>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>>>> >>>>> _______________________________________________ >>>>> Matplotlib-devel mailing list >>>>> Mat...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>>> -- >>>> Darren S. Dale, Ph.D. >>>> dd...@co... >>>> >>>> ------------------------------------------------------------------------- >>>> >>>> Using Tomcat but need to do more? Need to support web services, >>>> security? >>>> Get stuff done quickly with pre-integrated technology to make your >>>> job easier >>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache >>>> Geronimo >>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>>> >>>> _______________________________________________ >>>> Matplotlib-devel mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>>> >> >> ------------------------------------------------------------------------- >> >> Using Tomcat but need to do more? Need to support web services, >> security? >> Get stuff done quickly with pre-integrated technology to make your >> job easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache >> Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> Matplotlib-devel mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > |
From: John H. <jdh...@ac...> - 2006-11-13 17:59:55
|
>>>>> "Ted" == Ted Drain <ted...@jp...> writes: Ted> John et al, Ran into this bug in lines.py: The Verbose class Ted> in __init__.py doesn't have a method named report_error - Ted> just report. Thanks Ted -- just committed the fix. JDH |
From: Ted D. <ted...@jp...> - 2006-11-13 17:56:11
|
John et al, Ran into this bug in lines.py: The Verbose class in __init__.py doesn't have a method named report_error - just report. Ted =================================================================== --- lines.py (revision 2870) +++ lines.py (working copy) @@ -430,7 +430,7 @@ ACCEPTS: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' | ' ' | '' ] """ if linestyle not in self._lineStyles: - verbose.report_error('Unrecognized line style %s,%s'%(linestyle, type(linestyle))) + verbose.report('Unrecognized line style %s,%s'%(linestyle, type(linestyle))) if linestyle in [' ','']: linestyle = 'None' self._linestyle = linestyle @@ -448,7 +448,7 @@ """ if marker not in self._markers: - verbose.report_error('Unrecognized marker style %s, %s'%( marker, type(marker))) + verbose.report('Unrecognized marker style %s, %s'%( marker, type(marker))) if marker in [' ','']: marker = 'None' self._marker = marker Ted Drain Jet Propulsion Laboratory ted...@jp... |
From: Eric F. <ef...@ha...> - 2006-11-13 16:34:04
|
Ulf, Thanks for the report. I will check it out and either apply your patch or some other fix. Your message along with several others that were sent days ago popped up just now in my inbox. It seems like there are some strange delays in the sourceforge mailing list system. Eric Ulf Larsson wrote: > Hi, > > I have submitted a bug report > 1591708 pylab.axis('equal') scales wrong axis > In the attached script axis('eqaul') shrink x instead of expanding y > with the result that no > datapoints are seen. > > I have also submitted a simple patch > 1591716 Expand y if data don't fit into x_lim > It would be great if someone could take look. > It fixes the test case, but I'm not sure if it is the right way to do it. > > regards > Ulf Larsson > > _________________________________________________________________ > FREE pop-up blocking with the new MSN Toolbar - get it now! > http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ > > > ------------------------------------------------------------------------ > > import pylab > > x_data = [6.8538697159586812, > 6.8906683229002512, > 6.8495854795623092, > 6.887510586105912, > 6.8464139392062178, > 6.8830008172676411, > 6.8424628962958414, > 6.8810049485591289] > > y_data = [5.6629566741871935, > 5.6584471730561399, > 5.6629080444545945, > 5.6581494452612304, > 5.6630169070389558, > 5.659139916088753, > 5.6629980013160068, > 5.6581262160214072] > > pylab.figure() > pylab.plot(x_data, y_data, '+') > pylab.grid(1) > pylab.axis('equal') > pylab.show() > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel |
From: Eric F. <ef...@ha...> - 2006-11-12 04:31:44
|
John, It seems that ScalarMappable in cm.py, Artist in artist.py, and Button in widgets.py all have quite similar observer functionality, with some variable and method names in common and some not. None of this functionality seems to be used very extensively (a conclusion based only on a little grepping), but it is very important where it is needed. I made a quick fix to colorbar so that its alpha would track that of a ContourSet to which it is attached, in response to a bug report, but I think more extensive change is needed to make the colorbar track everything that it should, and I think this would be facilitated by abstracting the notifier/observer functionality into a very small mixin class (probably called Notifier). Ideally this would make the fuctionality less confusing (to me, at least) and easier to use in general. It is likely that I am missing something--maybe a lot of things--so I wanted to get your thoughts before proceeding. Thanks. Eric |
From: Eric F. <ef...@ha...> - 2006-11-11 23:11:30
|
This is fixed now in SVN. The problem was that Numeric arrays lack a "len" attribute, and "hasattr(xmin, 'len')" was being used to find out whether xmin is a scalar or a length-2 array (xmin, xmax). The solution is to do the test with "iterable(xmin)" instead. The bug was introduced in 2782. Eric Edin Salkovic wrote: > I'm posting this because of the other thread Darren started. > > I managed to reinstall python (and the modules I use) several days ago > and tried again to run matplotlib with Numeric as the default backend, > but got the same error (the same error Darren is getting). Then I > installed numpy, and everything was fixed :) > > Best, > Edin > > On 10/22/06, Edin Salkovic <edi...@gm...> wrote: >> Unfortunately, I forgot to do it :( >> >> Then, just after sending the message to the list, it sprang to my >> mind. To make it worse, I then mistakenly entered: >> rm -Rf /path/to/site-packages >> >> no matplotlib at the end, and hit enter. >> >> There goes my beautiful Python install. :'( >> >> Is there some switch to setup.py to make it remove the mpl dir or does >> one allways have to do it by hand? >> >> Cheers, >> Edin >> >> On 10/22/06, Darren Dale <dd...@co...> wrote: >>> Did you try deleting your old mpl directory from site-packages, remove the >>> build directory from you mpl sources, and rebuild from scratch? >>> >>> >>> >>> On Sunday 22 October 2006 6:59 am, Edin Salkovic wrote: >>>> Hi, >>>> >>>> I built and installed the latest matplotlib from SVN. >>>> >>>> When I type: >>>>>>> from pylab import * >>>>>>> plot([1,2,3]) >>>> I get: >>>> >>>> Traceback (most recent call last): >>>> File "<stdin>", line 1, in ? >>>> File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line >>>> 2027, in plot >>>> ret = gca().plot(*args, **kwargs) >>>> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line >>>> 2131, in plot self.autoscale_view(scalex=scalex, scaley=scaley) >>>> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line >>>> 985, in autoscale_view >>>> self.set_xlim(XL) >>>> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line >>>> 1227, in set_xlim >>>> self.viewLim.intervalx().set_bounds(xmin, xmax) >>>> TypeError: only length-1 arrays can be converted to Python scalars. >>>> >>>> I'm using Numeric as numerix. I'm on a Ubuntu box with python 2.4. >>>> >>>> ------------------------------------------------------------------------- >>>> Using Tomcat but need to do more? Need to support web services, security? >>>> Get stuff done quickly with pre-integrated technology to make your job >>>> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache >>>> Geronimo >>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>>> _______________________________________________ >>>> Matplotlib-devel mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>> -- >>> Darren S. Dale, Ph.D. >>> dd...@co... >>> >>> ------------------------------------------------------------------------- >>> Using Tomcat but need to do more? Need to support web services, security? >>> Get stuff done quickly with pre-integrated technology to make your job easier >>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>> _______________________________________________ >>> Matplotlib-devel mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>> > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel |
From: Edin S. <edi...@gm...> - 2006-11-10 23:21:50
|
I'm posting this because of the other thread Darren started. I managed to reinstall python (and the modules I use) several days ago and tried again to run matplotlib with Numeric as the default backend, but got the same error (the same error Darren is getting). Then I installed numpy, and everything was fixed :) Best, Edin On 10/22/06, Edin Salkovic <edi...@gm...> wrote: > Unfortunately, I forgot to do it :( > > Then, just after sending the message to the list, it sprang to my > mind. To make it worse, I then mistakenly entered: > rm -Rf /path/to/site-packages > > no matplotlib at the end, and hit enter. > > There goes my beautiful Python install. :'( > > Is there some switch to setup.py to make it remove the mpl dir or does > one allways have to do it by hand? > > Cheers, > Edin > > On 10/22/06, Darren Dale <dd...@co...> wrote: > > Did you try deleting your old mpl directory from site-packages, remove the > > build directory from you mpl sources, and rebuild from scratch? > > > > > > > > On Sunday 22 October 2006 6:59 am, Edin Salkovic wrote: > > > Hi, > > > > > > I built and installed the latest matplotlib from SVN. > > > > > > When I type: > > > >>> from pylab import * > > > >>> plot([1,2,3]) > > > > > > I get: > > > > > > Traceback (most recent call last): > > > File "<stdin>", line 1, in ? > > > File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line > > > 2027, in plot > > > ret = gca().plot(*args, **kwargs) > > > File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line > > > 2131, in plot self.autoscale_view(scalex=scalex, scaley=scaley) > > > File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line > > > 985, in autoscale_view > > > self.set_xlim(XL) > > > File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line > > > 1227, in set_xlim > > > self.viewLim.intervalx().set_bounds(xmin, xmax) > > > TypeError: only length-1 arrays can be converted to Python scalars. > > > > > > I'm using Numeric as numerix. I'm on a Ubuntu box with python 2.4. > > > > > > ------------------------------------------------------------------------- > > > Using Tomcat but need to do more? Need to support web services, security? > > > Get stuff done quickly with pre-integrated technology to make your job > > > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > > > Geronimo > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > _______________________________________________ > > > Matplotlib-devel mailing list > > > Mat...@li... > > > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > > > -- > > Darren S. Dale, Ph.D. > > dd...@co... > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > Matplotlib-devel mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > > |
From: Nicolas G. <nic...@ga...> - 2006-11-10 22:08:12
|
I'm playing with subplots_adjust, and I'm not comfortable with parameters wspace and hspace. Reading the doc, and the code, I've understood that: - left, bottom, right and top can be considered as a "percentage" of figure's width and height - wspace and hspace can be considered as a "percentage" of subplots's width and height In other words, left/bottom/right/top and wspace/hspace are not given in the same "unit": the former is given in "figure unit" whereas the latter is given in "subplot unit". I find these convention difficult to use when you try, for example, to have: wspace = left margin + right margin hspace = top margin + bottom margin Here is some Python code to be clear: left_margin, bottom_margin, right_margin, top_margin = 0.06, 0.06, 0, 0.1 pylab.subplots_adjust( left=left_margin, bottom=bottom_margin, right=1-right_margin, top=1-top_margin, wspace=left_margin+right_margin, hspace=bottom_margin+top_margin ) I tried, but it doesn't work as intended because i guessed wspace and hspace are a ratio of figure's size, but it seems they are a ratio of subplot's size, aren't they? Is it a design choice or just a matter of fact? Do you want to keep it that way or do you agree to change it? For example, with R (where I came from), figure's margin and subplot's margin are expressed in the same unit: inches or "lines" (a unit corresponding to the height of a line... very useful). Nicolas Grilly |
From: Darren D. <dd...@co...> - 2006-11-10 22:04:33
|
Let me correct that, I only see this problem with Numeric. numarray and numpy appear to be fine. On Friday 10 November 2006 13:23, Darren Dale wrote: > Can anyone reproduce this error? I am using up-to-date svn matplotlib, with > either numpy or numeric: > > plot([1,2]) > > --------------------------------------------------------------------------- > exceptions.TypeError Traceback (most recent > call last) > > /home/darren/<ipython console> > > /usr/lib64/python2.4/site-packages/matplotlib/pylab.py in plot(*args, > **kwargs) > 3087 hold(h) > 3088 try: > -> 3089 ret = gca().plot(*args, **kwargs) > 3090 draw_if_interactive() > 3091 except: > > /usr/lib64/python2.4/site-packages/matplotlib/axes.py in plot(self, *args, > **kwargs) > 2137 lines = [line for line in lines] # consume the generator > 2138 > -> 2139 self.autoscale_view(scalex=scalex, scaley=scaley) > 2140 return lines > 2141 > > /usr/lib64/python2.4/site-packages/matplotlib/axes.py in > autoscale_view(self, tight, scalex, scaley) > 991 if xl[1] < xl[0]: > 992 XL = XL[::-1] > --> 993 self.set_xlim(XL) > 994 if scaley: > 995 yl = self.get_ylim() > > /usr/lib64/python2.4/site-packages/matplotlib/axes.py in set_xlim(self, > xmin, xmax, emit) > 1233 xmax += 1e-38 > 1234 > -> 1235 self.viewLim.intervalx().set_bounds(xmin, xmax) > 1236 if emit: self._send_xlim_event() > 1237 return xmin, xmax > > TypeError: only length-1 arrays can be converted to Python scalars. |
From: John H. <jdh...@ac...> - 2006-11-10 20:17:50
|
>>>>> "Nicolas" == Nicolas Grilly <nic...@ga...> writes: Nicolas> I guess there is a very little error in documentation of Nicolas> pylab.subplots_adjust. Nicolas> The order of the arguments in the current doc is: Nicolas> subplots_adjust(left=None, right=None, bottom=None, Nicolas> top=None, wspace=0.2, hspace=0.2) Nicolas> The correct order of the arguments seems to be: Nicolas> subplots_adjust(left=None, bottom=None, right=None, Nicolas> top=None, wspace=0.2, hspace=0.2) Nicolas> Is it correct? Yep that's right, thanks. I always use the kwarg version and hadn't noticed the docstring bug. JDH |
From: Nicolas G. <nic...@ga...> - 2006-11-10 20:06:53
|
I guess there is a very little error in documentation of pylab.subplots_adjust. The order of the arguments in the current doc is: subplots_adjust(left=None, right=None, bottom=None, top=None, wspace=0.2, hspace=0.2) The correct order of the arguments seems to be: subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0.2, hspace=0.2) Is it correct? Thanks, Nicolas -- Garden - Conseil en Marketing & Datamining Nicolas Grilly Tel +33 1 45 72 48 78 Mob +33 6 03 00 25 34 www.garden-paris.com |