You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(2) |
2
(4) |
3
(16) |
4
(4) |
5
(15) |
6
(16) |
7
(6) |
8
(4) |
9
(9) |
10
(5) |
11
(8) |
12
(14) |
13
(19) |
14
(21) |
15
(8) |
16
(6) |
17
(10) |
18
(22) |
19
(15) |
20
(7) |
21
(21) |
22
(1) |
23
(6) |
24
(16) |
25
(12) |
26
(11) |
27
(27) |
28
(7) |
29
|
30
(4) |
31
(5) |
|
|
|
|
|
I am using Matplotlib version 1.0.1 and I get errors if I try the following: import matplotlib.pyplot as plt import numpy as np plt.specgram(np.zeros(50)) I have pasted the error output below, but hopefully it would reproduce in other systems. I'm not sure if this is intended behavior and was wondering. I came across this when I was plotting the specgram of my sound input, but my microphone was muted! --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_wx.pyc in _onPaint(self, evt) 1192 drawDC = wx.PaintDC(self) 1193 if not self._isDrawn: -> 1194 self.draw(drawDC=drawDC) 1195 else: 1196 self.gui_repaint(drawDC=drawDC) /usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_wxagg.pyc in draw(self, drawDC) 57 """ 58 DEBUG_MSG("draw()", 1, self) ---> 59 FigureCanvasAgg.draw(self) 60 61 self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None) /usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_agg.pyc in draw(self) 392 393 self.renderer = self.get_renderer() --> 394 self.figure.draw(self.renderer) 395 396 def get_renderer(self): /usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs) 53 def draw_wrapper(artist, renderer, *args, **kwargs): 54 before(artist, renderer) ---> 55 draw(artist, renderer, *args, **kwargs) 56 after(artist, renderer) 57 /usr/local/lib/python2.6/dist-packages/matplotlib/figure.pyc in draw(self, renderer) 796 dsu.sort(key=itemgetter(0)) 797 for zorder, func, args in dsu: --> 798 func(*args) 799 800 renderer.close_group('figure') /usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs) 53 def draw_wrapper(artist, renderer, *args, **kwargs): 54 before(artist, renderer) ---> 55 draw(artist, renderer, *args, **kwargs) 56 after(artist, renderer) 57 /usr/local/lib/python2.6/dist-packages/matplotlib/axes.pyc in draw(self, renderer, inframe) 1944 1945 for zorder, a in dsu: -> 1946 a.draw(renderer) 1947 1948 renderer.close_group('axes') /usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs) 53 def draw_wrapper(artist, renderer, *args, **kwargs): 54 before(artist, renderer) ---> 55 draw(artist, renderer, *args, **kwargs) 56 after(artist, renderer) 57 /usr/local/lib/python2.6/dist-packages/matplotlib/image.pyc in draw(self, renderer, *args, **kwargs) 352 warnings.warn("Image will not be shown correctly with this backend.") 353 --> 354 im = self.make_image(renderer.get_image_magnification()) 355 if im is None: 356 return /usr/local/lib/python2.6/dist-packages/matplotlib/image.pyc in make_image(self, magnification) 567 im, xmin, ymin, dxintv, dyintv, sx, sy = \ 568 self._get_unsampled_image(self._A, [_x1, _x2, _y1, _y2], --> 569 transformed_viewLim) 570 571 fc = self.axes.patch.get_facecolor() /usr/local/lib/python2.6/dist-packages/matplotlib/image.pyc in _get_unsampled_image(self, A, image_extents, viewlim) 199 else: 200 if self._rgbacache is None: --> 201 x = self.to_rgba(self._A, self._alpha) 202 self._rgbacache = x 203 else: /usr/local/lib/python2.6/dist-packages/matplotlib/cm.pyc in to_rgba(self, x, alpha, bytes) 191 pass 192 x = ma.asarray(x) --> 193 x = self.norm(x) 194 x = self.cmap(x, alpha=alpha, bytes=bytes) 195 return x /usr/local/lib/python2.6/dist-packages/matplotlib/colors.pyc in __call__(self, value, clip) 809 if vmin > vmax: 810 raise ValueError("minvalue must be less than or equal to maxvalue") --> 811 elif vmin==vmax: 812 result = 0.0 * val 813 else: /usr/lib/python2.6/dist-packages/numpy/ma/core.pyc in __eq__(self, other) 3117 mask = np.all([[f[n].all() for n in mask.dtype.names] 3118 for f in mask], axis=axis) -> 3119 check._mask = mask 3120 return check 3121 # AttributeError: 'numpy.bool_' object has no attribute '_mask'
Thank you very much for your patience, your explanations helped me a very lot in getting beautiful plots for my thesis! Best regards, Daniel
The zeros(...) statement needs a contiguous block of > 800 MB RAM and the conversion another contiguous block of > 400 MB. Memory allocated during the matplotlib import statement could easily fragment the available memory such that no 800 + 400 MB blocks exist. Try monitoring your memory usage and import matplotlib after allocating/converting the array. Anyway, you'll be better off using a 64 bit system if you deal with such amount of data. Christoph On 1/14/2011 12:17 PM, sprobst wrote: > > Dear Christoph, > > It is not a memory problem, because before the programm starts I have more > than 1.3 GB free memory left. And on the other hand it depends on the import > line! There seems to be some interference of the packages. My Python version > is 2.6 (needed by another programm), perhaps that also makes the difference. > > But thank you for the quick answer! > Stefan >
Dear Christoph, It is not a memory problem, because before the programm starts I have more than 1.3 GB free memory left. And on the other hand it depends on the import line! There seems to be some interference of the packages. My Python version is 2.6 (needed by another programm), perhaps that also makes the difference. But thank you for the quick answer! Stefan -- View this message in context: http://old.nabble.com/MemoryError-with-import-matplotlib-tp30674798p30675089.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Fri, Jan 14, 2011 at 1:40 PM, sprobst <Ste...@gm...> wrote: > > Hi all, > > I tried to plot parts of a large 3D array with each 4 float64 entries. > Loading the array with numpy.fromfile and performing a type conversion > afterwards ends up in a MemoryError. > > The following code reproduces the error: > *********************************** > import gc > > from os import path > from numpy import zeros, empty, float32, float64, fromfile > > # With the imports of the next three lines a memory error occurs > #import matplotlib > #matplotlib.use("AGG") > #import matplotlib.pylab as plt > > _filename = "mt.dat" > > if (path.exists(_filename)==False): > print "Write file ..." > _mtf = file(_filename, "wb") > _mtd = zeros( (300,300,300,4),dtype=float64) > _mtd.tofile(_mtf) > _mtf.close() > > _mtd = empty((0)) > gc.collect(); > > print "Try to read file ..." > > _mtf = file(_filename, "rb") > # The memory error occurs with the type conversion to float 64, > # but only if mathplotlib is imported! > _mtd = fromfile(_mtf,float64).astype(float32) > _mtf.close() > > print "Successful read:",_mtd.shape > > # Here some plot stuff would be :) > *********************************** > > If the import of matplotlib is not included, no error occures otherwise it > will not work. Perhaps anybody can help me (I tested it only on a Windows > XP > 32Bit). > > Best regards and thank you > Stefan > Stefan, I don't know if it would make a difference, but I see that you are importing matplotlib.pylab as plt. This is not a typical way of importing matplotlib. Try instead: import matplotlib.pyplot as plt Ben Root
Works for me on Windows 7 64 bit with 32 bit Python. I believe you simply run out of memory. On a 32 bit Windows OS, Python can only use 2 GB, which it has to share with other all processes. zeros((300,300,300,4),dtype=float64) requires ~820MB of contiguous memory, which might not be available even if you have >1 GB free RAM. Better use a 64 bit OS and Python. Christoph On 1/14/2011 11:40 AM, sprobst wrote: > > Hi all, > > I tried to plot parts of a large 3D array with each 4 float64 entries. > Loading the array with numpy.fromfile and performing a type conversion > afterwards ends up in a MemoryError. > > The following code reproduces the error: > *********************************** > import gc > > from os import path > from numpy import zeros, empty, float32, float64, fromfile > > # With the imports of the next three lines a memory error occurs > #import matplotlib > #matplotlib.use("AGG") > #import matplotlib.pylab as plt > > _filename = "mt.dat" > > if (path.exists(_filename)==False): > print "Write file ..." > _mtf = file(_filename, "wb") > _mtd = zeros( (300,300,300,4),dtype=float64) > _mtd.tofile(_mtf) > _mtf.close() > > _mtd = empty((0)) > gc.collect(); > > print "Try to read file ..." > > _mtf = file(_filename, "rb") > # The memory error occurs with the type conversion to float 64, > # but only if mathplotlib is imported! > _mtd = fromfile(_mtf,float64).astype(float32) > _mtf.close() > > print "Successful read:",_mtd.shape > > # Here some plot stuff would be :) > *********************************** > > If the import of matplotlib is not included, no error occures otherwise it > will not work. Perhaps anybody can help me (I tested it only on a Windows XP > 32Bit). > > Best regards and thank you > Stefan
On 01/14/2011 02:02 AM, Daniel Mader wrote: > Hi Eric, > > thanks for your feedback, it helped a lot! I have some questions left, > see below. > > 2011年1月14日 Eric Firing<ef...@ha...>: >> Quick thoughts with no testing or concrete examples: >> >> 1) Don't set the cmap or norm for the colorbar; let it inherit those >> properties from the mappable to which it is connected. > > Am I doing this correctly in the attached code? It seems there are > several ways of doing this... Which is the suggested one? How can I > label the colorbar? The way you did it is fine. For the label, modify by keeping a reference to the colorbar and then calling set_label: cb = fig.colorbar(collist[-1], shrink=0.85,)#, aspect=5) cb.set_label('whatever this is') > >> 2) Ensure that the cmap and norm are the same for all collections. You >> are already taking care of the cmap, so the problem is that you are >> autoscaling the collections separately, which is setting vmin and vmax >> to different values for the different collections. Use the data to >> figure out the range (vmin, vmax) that you want the colors to span, and >> then for each collection, instead of col.autoscale(), use >> >> col.norm.vmin = vmin >> col.norm.vmax = vmax > > That was what I needed, see code :) > >> (You could also make a single norm instance for all the collections to >> use, just as with the cmap, so that you only have to set vmin and vmax >> once.) > > And this I don't understandm could you please elaborate? See attached modification. Eric > > Thanks a very lot in advance > best regards from Austria, > > Daniel
Hi all, I tried to plot parts of a large 3D array with each 4 float64 entries. Loading the array with numpy.fromfile and performing a type conversion afterwards ends up in a MemoryError. The following code reproduces the error: *********************************** import gc from os import path from numpy import zeros, empty, float32, float64, fromfile # With the imports of the next three lines a memory error occurs #import matplotlib #matplotlib.use("AGG") #import matplotlib.pylab as plt _filename = "mt.dat" if (path.exists(_filename)==False): print "Write file ..." _mtf = file(_filename, "wb") _mtd = zeros( (300,300,300,4),dtype=float64) _mtd.tofile(_mtf) _mtf.close() _mtd = empty((0)) gc.collect(); print "Try to read file ..." _mtf = file(_filename, "rb") # The memory error occurs with the type conversion to float 64, # but only if mathplotlib is imported! _mtd = fromfile(_mtf,float64).astype(float32) _mtf.close() print "Successful read:",_mtd.shape # Here some plot stuff would be :) *********************************** If the import of matplotlib is not included, no error occures otherwise it will not work. Perhaps anybody can help me (I tested it only on a Windows XP 32Bit). Best regards and thank you Stefan -- View this message in context: http://old.nabble.com/MemoryError-with-import-matplotlib-tp30674798p30674798.html Sent from the matplotlib - users mailing list archive at Nabble.com.
Seems that deleting fontList.cache did it. Michael Droettboom wrote: > You can try deleting matplotlib's font cache in > ~/.matplotlib/fontList.cache. > > If that doesn't work, set the rcParam "verbose.level" to > "debug-annoying" and send us the output... > > Mike > > On 01/14/2011 08:10 AM, Neal Becker wrote: >> I have several machines running fedora f14. 2 of them produce plots fine >> with STIX, but 1 doesn't, but gives: >> /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:1242: >> UserWarning: findfont: Font family ['STIXSizeOneSym'] not found. Falling back >> to Bitstream Vera Sans >> (prop.get_family(), self.defaultFamily[fontext])) >> /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:1252: >> UserWarning: findfont: Could not match :family=Bitstream Vera >> Sans:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. >> Returning /usr/share/fonts/thai-scalable/Waree-Oblique.ttf >> UserWarning) >> /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:1242: >> UserWarning: findfont: Font family ['STIXSizeThreeSym'] not found. Falling >> back to Bitstream Vera Sans >> (prop.get_family(), self.defaultFamily[fontext])) >> ... >> >> On that machine I have: >> Package stix-variants-fonts-1.0.0-1.fc14.noarch already installed and latest >> version >> Package stix-pua-fonts-1.0.0-1.fc14.noarch already installed and latest >> version Package stix-fonts-1.0.0-1.fc14.noarch already installed and latest >> version Package stix-fonts-doc-1.0.0-1.fc14.noarch already installed and >> latest version Package stix-sizes-fonts-1.0.0-1.fc14.noarch already installed >> and latest version >> Package stix-integrals-fonts-1.0.0-1.fc14.noarch already installed and latest >> version >> >> rpm -q python-matplotlib >> python-matplotlib-1.0.0-2.fc14.x86_64 >> >> Any ideas how to debug this? >> >> >> ------------------------------------------------------------------------------ >> Protect Your Site and Customers from Malware Attacks >> Learn about various malware tactics and how to avoid them. Understand >> malware threats, the impact they can have on your business, and how you >> can protect your company and customers by using code signing. >> http://p.sf.net/sfu/oracle-sfdevnl >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > >
2011年1月14日 Thøger Emil Juul Thorsen <th...@fy...> > Hi list; > > I am trying to do an imshow() comparison of four different data sets > (astronomical photos), and since I want to show the differences in > strength, I use fixed vmin and vmax. > > I would very much like one and only one colour bar for the entire > figure, but I haven't been able to figure out how to do it without > creating an entire subplot for it, and that is really kludgey and > unhandy. > > I tried the Interwebz but have had no luck figuring it out. > > Cheers; > > Emil > > Emil, I had this problem once before. You can use the axes_grid1 tool to do this: http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html Unfortunately, our documentation is a little broken on that page, but if you take a look at this source code example, you can see how to use AxesGrid to create a subplot grid that pre-allocates space for a single cbar automatically! http://matplotlib.sourceforge.net/plot_directive/mpl_toolkits/axes_grid/examples/demo_axes_grid.py I hope this helps! Ben Root
You can try deleting matplotlib's font cache in ~/.matplotlib/fontList.cache. If that doesn't work, set the rcParam "verbose.level" to "debug-annoying" and send us the output... Mike On 01/14/2011 08:10 AM, Neal Becker wrote: > I have several machines running fedora f14. 2 of them produce plots fine with > STIX, but 1 doesn't, but gives: > /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:1242: UserWarning: > findfont: Font family ['STIXSizeOneSym'] not found. Falling back to Bitstream > Vera Sans > (prop.get_family(), self.defaultFamily[fontext])) > /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:1252: UserWarning: > findfont: Could not match :family=Bitstream Vera > Sans:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. > Returning /usr/share/fonts/thai-scalable/Waree-Oblique.ttf > UserWarning) > /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:1242: UserWarning: > findfont: Font family ['STIXSizeThreeSym'] not found. Falling back to Bitstream > Vera Sans > (prop.get_family(), self.defaultFamily[fontext])) > ... > > On that machine I have: > Package stix-variants-fonts-1.0.0-1.fc14.noarch already installed and latest > version > Package stix-pua-fonts-1.0.0-1.fc14.noarch already installed and latest version > Package stix-fonts-1.0.0-1.fc14.noarch already installed and latest version > Package stix-fonts-doc-1.0.0-1.fc14.noarch already installed and latest version > Package stix-sizes-fonts-1.0.0-1.fc14.noarch already installed and latest > version > Package stix-integrals-fonts-1.0.0-1.fc14.noarch already installed and latest > version > > rpm -q python-matplotlib > python-matplotlib-1.0.0-2.fc14.x86_64 > > Any ideas how to debug this? > > > ------------------------------------------------------------------------------ > Protect Your Site and Customers from Malware Attacks > Learn about various malware tactics and how to avoid them. Understand > malware threats, the impact they can have on your business, and how you > can protect your company and customers by using code signing. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA
Hi list; I am trying to do an imshow() comparison of four different data sets (astronomical photos), and since I want to show the differences in strength, I use fixed vmin and vmax. I would very much like one and only one colour bar for the entire figure, but I haven't been able to figure out how to do it without creating an entire subplot for it, and that is really kludgey and unhandy. I tried the Interwebz but have had no luck figuring it out. Cheers; Emil
On Fri, Jan 14, 2011 at 5:06 AM, Bala subramanian <bal...@gm... > wrote: > Dear Friends, i used the following code to create a 3D plot (attached > figure). I manipulate the appearance of the graph. Someone please enlighten > me on the same. I dnt get what functions should i use to do the following > manipulations. > > 1) How to remove the blue shading in the grid > 2) How to change the distance between the axis label and axis tick labels > Unfortunately, this is not possible to do with the current version of matplotlib. I have been working on making this (somewhat) possible in the next release. One thing you can do to make the axes labels look "better" is to trigger mplot3d's internal logic to rotate the labels to be parallel to the axes. mplot3d automatically rotates labels that have more than 4 characters in them. So, if you want "PC1" to be rotated, set the axis label to " PC1 " with spaces so that it will have 5 characters and get rotated. > 3) How to set the interval of the axis ticks. For example the xlim varies > from -80 to 60. I want to set xticks at an interval of 30 rather than 20 as > in the plot. > > My code. > import numpy as np > import matplotlib as mpl > from mpl_toolkits.mplot3d import Axes3D > import matplotlib.pyplot as plt > > FIG=plt.figure(figsize=(4.,3.27),dpi=200) > ax = Axes3D(FIG,azim=-60,elev=15) > > x=np.reshape(np.loadtxt(data[0]),15000) > y=np.reshape(np.loadtxt(data[1]),15000) > z=np.reshape(np.loadtxt(data[2]),15000) > > ax.scatter3D(x[::10],y[::10],z[::10],edgecolors=col[i],facecolors='white',marker=mar[i],s=5,alpha=0.7) > ax.set_xlabel('PC1',size=8) > ax.set_ylabel('PC2',size=8) > ax.set_zlabel('PC3',size=8) > ax.set_xlim3d(-80,60,30) > ax.set_ylim3d(-40,50,30) > ax.set_zlim3d(-40,40,30) > > > Passing '30' to set_xlim to set the tick intervals is not a feature in both regular 2d plotting and 3d plotting, so I don't know how you expected that to work. If you want to manually control the axis ticks, you can use axis locators just like for 2D plots, keeping in mind that the axis objects for 3d plots are ax.w_xaxis, ax.w_yaxis, and ax.w_zaxis (where for a 2d plot, it would be ax.xaxis, ax.yaxis, ax.zaxis). I hope this helps! Ben Root
Friends, I sent the following mail to mpl users with a figure. Since the size was bigger, it bounced back to my email. So i am fwd it again without attaching the figure. It seems that i can only set tick labels and limits of the axes using set_xlabel and set_xlim3d functions.Basically i want to know how to manipulate the x,y and z ticks intervals for a graph created with Axes3D. On Fri, Jan 14, 2011 at 12:06 PM, Bala subramanian < bal...@gm...> wrote: > Dear Friends, i used the following code to create a 3D plot (attached > figure). I manipulate the appearance of the graph. Someone please enlighten > me on the same. I dnt get what functions should i use to do the following > manipulations. > > 1) How to remove the blue shading in the grid > 2) How to change the distance between the axis label and axis tick labels > 3) How to set the interval of the axis ticks. For example the xlim varies > from -80 to 60. I want to set xticks at an interval of 30 rather than 20 as > in the plot. > > My code. > import numpy as np > import matplotlib as mpl > from mpl_toolkits.mplot3d import Axes3D > import matplotlib.pyplot as plt > > FIG=plt.figure(figsize=(4.,3.27),dpi=200) > ax = Axes3D(FIG,azim=-60,elev=15) > > x=np.reshape(np.loadtxt(data[0]),15000) > y=np.reshape(np.loadtxt(data[1]),15000) > z=np.reshape(np.loadtxt(data[2]),15000) > > ax.scatter3D(x[::10],y[::10],z[::10],edgecolors=col[i],facecolors='white',marker=mar[i],s=5,alpha=0.7) > ax.set_xlabel('PC1',size=8) > ax.set_ylabel('PC2',size=8) > ax.set_zlabel('PC3',size=8) > ax.set_xlim3d(-80,60,30) > ax.set_ylim3d(-40,50,30) > ax.set_zlim3d(-40,40,30) > > > > > > > > > > >
I have several machines running fedora f14. 2 of them produce plots fine with STIX, but 1 doesn't, but gives: /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['STIXSizeOneSym'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:1252: UserWarning: findfont: Could not match :family=Bitstream Vera Sans:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. Returning /usr/share/fonts/thai-scalable/Waree-Oblique.ttf UserWarning) /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['STIXSizeThreeSym'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) ... On that machine I have: Package stix-variants-fonts-1.0.0-1.fc14.noarch already installed and latest version Package stix-pua-fonts-1.0.0-1.fc14.noarch already installed and latest version Package stix-fonts-1.0.0-1.fc14.noarch already installed and latest version Package stix-fonts-doc-1.0.0-1.fc14.noarch already installed and latest version Package stix-sizes-fonts-1.0.0-1.fc14.noarch already installed and latest version Package stix-integrals-fonts-1.0.0-1.fc14.noarch already installed and latest version rpm -q python-matplotlib python-matplotlib-1.0.0-2.fc14.x86_64 Any ideas how to debug this?
Hi Eric, thanks for your feedback, it helped a lot! I have some questions left, see below. 2011年1月14日 Eric Firing <ef...@ha...>: > Quick thoughts with no testing or concrete examples: > > 1) Don't set the cmap or norm for the colorbar; let it inherit those > properties from the mappable to which it is connected. Am I doing this correctly in the attached code? It seems there are several ways of doing this... Which is the suggested one? How can I label the colorbar? > 2) Ensure that the cmap and norm are the same for all collections. You > are already taking care of the cmap, so the problem is that you are > autoscaling the collections separately, which is setting vmin and vmax > to different values for the different collections. Use the data to > figure out the range (vmin, vmax) that you want the colors to span, and > then for each collection, instead of col.autoscale(), use > > col.norm.vmin = vmin > col.norm.vmax = vmax That was what I needed, see code :) > (You could also make a single norm instance for all the collections to > use, just as with the cmap, so that you only have to set vmin and vmax > once.) And this I don't understandm could you please elaborate? Thanks a very lot in advance best regards from Austria, Daniel
Hooo, well done! This is it. I didn't knew about caching... I was indeed using ipython, but I did led some test using the basic python interpreter,with same results, so I did not mention this point. In fact, python's basic interpreter still records the last three outputs. As my tests were really short (plt.close() ; mpl.cbook.report_memory() ; gc.collect() is only two lines before the collect, only o)ne o,f theme outputt ing something) even pyhton's caching was still at work, and the garbage collector could not free anything. Thanks a lot, and also thanks to Ben for taking interest ! Jules PS : Gary, sorry, for the duplicated mail... Le 14 janv. 2011 à 04:04, gary ruben a écrit : > You're not doing this from ipython are you? It's cache hangs onto the > plot object references and stops python's garbage collector from > releasing them. If so, you can disable the cache as a workaround. A > better option would be if ipython implemented an option to avoid > caching references to matplotlib objects. > > Gary R. > > On Fri, Jan 14, 2011 at 2:59 AM, Benjamin Root <ben...@ou...> wrote: >> On Thu, Jan 13, 2011 at 7:54 AM, CASOLI Jules <jul...@ce...> wrote: >>> >>> Hello to all, >>> >>> This is yet another question about matplotlib not freeing memory, when >>> closing a figure (using close()). >>> Here is what I'm doing (tried with several backends, on MacOSX and Linux, >>> with similar results): >>> -------------------- >>> import matplotlib as mpl >>> from matplotlib import pylot as plt >>> import numpy as np >>> >>> a = np.arange(1000000) >>> mpl.cbook.report_memory() >>> # -> output: 54256 >>> plt.plot(a) >>> mpl.cbook.report_memory() >>> # -> output: 139968 >>> plt.close() >>> mpl.cbook.report_memory() >>> # -> output: 138748 >>> -------------------- >>> >>> Shouldn't plt.close() close the figure _and_ free the memory used by it? >>> What am I doing wrong ? >>> I tried several other ways to free the memory, such as f = figure(); ... ; >>> del f, without luck. >>> >>> Any help appreciated ! >>> >>> P.S. : side question : how come the call to plot take so much memory (90MB >>> for a 8MB array ?). I have read somewhere that each point is coded on three >>> RGB floats, but it only means an approx. 12MB plot... (plus small overhead) >>> >>> Jules >>> >>> >> >> Jules, >> >> Which version of Matplotlib are you using and which backend? On my Linux >> install of matplotlib (development branch) using GTKAgg, the memory usage >> does get high during the call to show(), but returns to (near) normal >> amounts after I close. An interesting observation is that if the >> interactive mode is off, the memory usage returns back to just a few >> kilobytes above where it was before, but if interactive mode was turned on, >> the memory usage returned to being a few hundred kilobytes above where it >> started. >> >> Ben Root >> >> P.S. - As a side note, estimating the memory size of these plots from the >> given data isn't as straight-forward as multiplying by three (actually, it >> would be four because of the transparency value in addition to rgb). There >> are many other parts of the graph that needs to be represented (all having >> rgba values) but there are also a lot of simplifications that are done to >> reduce the amount of memory needed to represent these objects. >> >> ------------------------------------------------------------------------------ >> Protect Your Site and Customers from Malware Attacks >> Learn about various malware tactics and how to avoid them. Understand >> malware threats, the impact they can have on your business, and how you >> can protect your company and customers by using code signing. >> http://p.sf.net/sfu/oracle-sfdevnl >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >>
You're not doing this from ipython are you? It's cache hangs onto the plot object references and stops python's garbage collector from releasing them. If so, you can disable the cache as a workaround. A better option would be if ipython implemented an option to avoid caching references to matplotlib objects. Gary R. On Fri, Jan 14, 2011 at 2:59 AM, Benjamin Root <ben...@ou...> wrote: > On Thu, Jan 13, 2011 at 7:54 AM, CASOLI Jules <jul...@ce...> wrote: >> >> Hello to all, >> >> This is yet another question about matplotlib not freeing memory, when >> closing a figure (using close()). >> Here is what I'm doing (tried with several backends, on MacOSX and Linux, >> with similar results): >> -------------------- >> import matplotlib as mpl >> from matplotlib import pylot as plt >> import numpy as np >> >> a = np.arange(1000000) >> mpl.cbook.report_memory() >> # -> output: 54256 >> plt.plot(a) >> mpl.cbook.report_memory() >> # -> output: 139968 >> plt.close() >> mpl.cbook.report_memory() >> # -> output: 138748 >> -------------------- >> >> Shouldn't plt.close() close the figure _and_ free the memory used by it? >> What am I doing wrong ? >> I tried several other ways to free the memory, such as f = figure(); ... ; >> del f, without luck. >> >> Any help appreciated ! >> >> P.S. : side question : how come the call to plot take so much memory (90MB >> for a 8MB array ?). I have read somewhere that each point is coded on three >> RGB floats, but it only means an approx. 12MB plot... (plus small overhead) >> >> Jules >> >> > > Jules, > > Which version of Matplotlib are you using and which backend? On my Linux > install of matplotlib (development branch) using GTKAgg, the memory usage > does get high during the call to show(), but returns to (near) normal > amounts after I close. An interesting observation is that if the > interactive mode is off, the memory usage returns back to just a few > kilobytes above where it was before, but if interactive mode was turned on, > the memory usage returned to being a few hundred kilobytes above where it > started. > > Ben Root > > P.S. - As a side note, estimating the memory size of these plots from the > given data isn't as straight-forward as multiplying by three (actually, it > would be four because of the transparency value in addition to rgb). There > are many other parts of the graph that needs to be represented (all having > rgba values) but there are also a lot of simplifications that are done to > reduce the amount of memory needed to represent these objects. > > ------------------------------------------------------------------------------ > Protect Your Site and Customers from Malware Attacks > Learn about various malware tactics and how to avoid them. Understand > malware threats, the impact they can have on your business, and how you > can protect your company and customers by using code signing. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
On 01/13/2011 01:40 PM, Daniel Mader wrote: > Hi, > > I am trying to plot a set of simulation results of FEM simulations. > With a lot of help from Ben I can plot the deformed shape quite nicely > but I have trouble in applying a colorbar to the plot. > > In the attached file there are three results with different results. > > How can I apply a "global" colorbar so that all collections are nicely > represented? Quick thoughts with no testing or concrete examples: 1) Don't set the cmap or norm for the colorbar; let it inherit those properties from the mappable to which it is connected. 2) Ensure that the cmap and norm are the same for all collections. You are already taking care of the cmap, so the problem is that you are autoscaling the collections separately, which is setting vmin and vmax to different values for the different collections. Use the data to figure out the range (vmin, vmax) that you want the colors to span, and then for each collection, instead of col.autoscale(), use col.norm.vmin = vmin col.norm.vmax = vmax (You could also make a single norm instance for all the collections to use, just as with the cmap, so that you only have to set vmin and vmax once.) Eric > > Thanks a lot in advance, > Daniel > > > > ------------------------------------------------------------------------------ > Protect Your Site and Customers from Malware Attacks > Learn about various malware tactics and how to avoid them. Understand > malware threats, the impact they can have on your business, and how you > can protect your company and customers by using code signing. > http://p.sf.net/sfu/oracle-sfdevnl > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Chris Fonnesbeck, on 2011年01月13日 14:07, wrote: > I was hoping (and still hope) that Matplotlib is able to choose > reasonable ticks on the log scale that do not overlap, but are > more informative than just powers of 10. Chris, Sorry, I'm no expert with the locators, I rarely find myself needing to mess with them. The cleaner way to get something other than decades is to specify basex and basey. To do this for a plot already created, you'll need to set the base of the LogLocator and LogFormatter of your minor and major axes, like: fmat = plt.gca().xaxis.get_major_formatter() fmat.base(2) loc = plt.gca().xaxis.get_major_locator() loc.base(2) I'm afraid I'm quite out of my element with these guys, maybe someone else chimes in with another approach. Do post again to clarify what you want. Note that by default, the minor_formatter is set to be a NullFormatter, thus no labels will be placed at the minor tick locations. That would be a reasonable way to proceed - set the major ticks to be non-overlapping, and put the minor ones everywhere else. You've probably already found it, but just in case: http://matplotlib.sourceforge.net/api/ticker_api.html -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7