SourceForge logo
SourceForge logo
Menu

matplotlib-devel — matplotlib developers

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
(4)
2
(4)
3
(13)
4
(4)
5
(1)
6
(5)
7
(5)
8
(6)
9
(20)
10
(1)
11
12
(11)
13
(4)
14
(2)
15
(1)
16
(1)
17
(4)
18
(5)
19
(5)
20
21
(1)
22
(1)
23
(2)
24
25
(6)
26
(1)
27
28
29
(7)
30
(12)





Showing 6 results of 6

From: Gary R. <gr...@bi...> - 2009年11月08日 12:03:32
So I think the change I suggested takes care of the floating point case, 
except that the vmin and vmax values don't default to 0.0 and 1.0. I 
wonder whether this is enough of a surprise to warrant some logic to set 
 vmin and vmax in some cases, such as iff all array values are floats 
in the range 0.0-1.0 and neither vmin nor vmax have been specified as 
arguments, then use vmin=0.0 and vmax=1.0. Should we aim to replicate 
the scipy imsave behaviour exactly? Another possible problem with the 
current behaviour is that single bit plane arrays currently get saved as 
RGB - I don't know if this can be changed easily.
Gary
Stéfan van der Walt wrote:
> Hi Gary
> 
> Sorry, I didn't even read the docstring since I have been using
> SciPy's "imsave" so far.
> 
> 2009年11月8日 Gary Ruben <gr...@bi...>:
>> This may be all you need. My tests (in the attached test.py) appear to
>> work. However, I don't think it's what you want. By default, figimage
>> even expects NxMx3 and NxMx4 arrays to be float arrays nominally ranging
>> from 0-1. What you probably want is a raw RGB mapping where pixel planes
>> are unsigned 8 bit values. I thought calling figimage with a
>> norm=no_norm(0,255) instance achieved this but it doesn't work as I
>> expect. So the first question is, what is the expected behaviour here,
>> and a follow-up is does anyone here understand how to do the colour
>> mapping to achieve it?
> 
> We assume that arrays of dtype uint8 represent intensities 0 through
> 255, and that floating point arrays are between 0-1.
> 
> Regards
> Stéfan
> 
From: Stéfan v. d. W. <st...@su...> - 2009年11月08日 11:06:07
Hi Gary
Sorry, I didn't even read the docstring since I have been using
SciPy's "imsave" so far.
2009年11月8日 Gary Ruben <gr...@bi...>:
> This may be all you need. My tests (in the attached test.py) appear to
> work. However, I don't think it's what you want. By default, figimage
> even expects NxMx3 and NxMx4 arrays to be float arrays nominally ranging
> from 0-1. What you probably want is a raw RGB mapping where pixel planes
> are unsigned 8 bit values. I thought calling figimage with a
> norm=no_norm(0,255) instance achieved this but it doesn't work as I
> expect. So the first question is, what is the expected behaviour here,
> and a follow-up is does anyone here understand how to do the colour
> mapping to achieve it?
We assume that arrays of dtype uint8 represent intensities 0 through
255, and that floating point arrays are between 0-1.
Regards
Stéfan
From: Michiel de H. <mjl...@ya...> - 2009年11月08日 07:23:47
I guess you're right... I misunderstood the result of gc.collect() as the number of objects that could not be freed. The good news is that after fixing the bug I was looking at, there are no more objects that cannot be freed (gc.garbage is empty).
Thanks!
--Michiel.
--- On Sun, 11/8/09, Eric Firing <ef...@ha...> wrote:
> From: Eric Firing <ef...@ha...>
> Subject: Re: [matplotlib-devel] Circular references in Figure
> To: "Michiel de Hoon" <mjl...@ya...>
> Cc: mat...@li...
> Date: Sunday, November 8, 2009, 1:43 AM
> Michiel de Hoon wrote:
> > Hi everybody,
> > 
> > I was looking at this bug about a memory leak:
> > 
> > https://sourceforge.net/tracker/?func=detail&atid=560720&aid=2889570&group_id=80706
> > 
> > While this bug is now essentially fixed, I noticed
> that the Figure class contains some circular references that
> prevent it from being cleaned up by the garbage collector,
> which is effectively a memory leak. At least, for this
> code:
> > 
> >>>> from matplotlib.figure import Figure
> >>>> fig = Figure()
> >>>> del fig
> > 
> > the garbage collector reports 76 unreachable objects.
> This seems to be independent of which backend is being
> used.
> > 
> > Is it worthwhile to look deeper into it? Or should we
> accept that it is unavoidable that a library of the size of
> matplotlib will have circular references?
> > 
> 
> The purpose of the garbage collector is to handle the case
> of circular references--and mpl is full of circular
> references. When there are no circular references,
> then reference counting suffices. The garbage
> collector fails to handle circular references when an object
> has a __del__ method. I don't think we have that
> problem.
> 
> I am not actually seeing the result you describe,
> though. Using python from the interactive prompt--no
> ipython--when I do gc.collect() and then gc.get_count() I
> get back to the count from before instantiating the Figure.
> 
> >>> gc.get_count()
> (4, 0, 0)
> >>> gc.get_count()
> (5, 0, 0)
> >>> gc.get_count()
> (5, 0, 0)
> >>> gc.get_count()
> (5, 0, 0)
> >>> fig = Figure()
> >>> gc.get_count()
> (128, 0, 0)
> >>> del(fig)
> >>> gc.get_count()
> (128, 0, 0)
> >>> gc.collect()
> 76
> >>> gc.get_count()
> (4, 0, 0)
> >>> gc.get_count()
> (5, 0, 0)
> 
> Eric
> 
> > 
> > --Michiel.
> > 
> 
 
From: Eric F. <ef...@ha...> - 2009年11月08日 06:44:05
Michiel de Hoon wrote:
> Hi everybody,
> 
> I was looking at this bug about a memory leak:
> 
> https://sourceforge.net/tracker/?func=detail&atid=560720&aid=2889570&group_id=80706
> 
> While this bug is now essentially fixed, I noticed that the Figure class contains some circular references that prevent it from being cleaned up by the garbage collector, which is effectively a memory leak. At least, for this code:
> 
>>>> from matplotlib.figure import Figure
>>>> fig = Figure()
>>>> del fig
> 
> the garbage collector reports 76 unreachable objects. This seems to be independent of which backend is being used.
> 
> Is it worthwhile to look deeper into it? Or should we accept that it is unavoidable that a library of the size of matplotlib will have circular references?
> 
The purpose of the garbage collector is to handle the case of circular 
references--and mpl is full of circular references. When there are no 
circular references, then reference counting suffices. The garbage 
collector fails to handle circular references when an object has a 
__del__ method. I don't think we have that problem.
I am not actually seeing the result you describe, though. Using python 
from the interactive prompt--no ipython--when I do gc.collect() and then 
gc.get_count() I get back to the count from before instantiating the Figure.
 >>> gc.get_count()
(4, 0, 0)
 >>> gc.get_count()
(5, 0, 0)
 >>> gc.get_count()
(5, 0, 0)
 >>> gc.get_count()
(5, 0, 0)
 >>> fig = Figure()
 >>> gc.get_count()
(128, 0, 0)
 >>> del(fig)
 >>> gc.get_count()
(128, 0, 0)
 >>> gc.collect()
76
 >>> gc.get_count()
(4, 0, 0)
 >>> gc.get_count()
(5, 0, 0)
Eric
> 
> --Michiel.
> 
From: Michiel de H. <mjl...@ya...> - 2009年11月08日 05:13:27
Hi everybody,
I was looking at this bug about a memory leak:
https://sourceforge.net/tracker/?func=detail&atid=560720&aid=2889570&group_id=80706
While this bug is now essentially fixed, I noticed that the Figure class contains some circular references that prevent it from being cleaned up by the garbage collector, which is effectively a memory leak. At least, for this code:
>>> from matplotlib.figure import Figure
>>> fig = Figure()
>>> del fig
the garbage collector reports 76 unreachable objects. This seems to be independent of which backend is being used.
Is it worthwhile to look deeper into it? Or should we accept that it is unavoidable that a library of the size of matplotlib will have circular references?
--Michiel.
 
From: Gary R. <gr...@bi...> - 2009年11月08日 03:27:59
Attachments: my_plottools.py test.py
Currently imsave (implemented in the image.py file) only deals with 
greyscale single-plane images, i.e. 2D arrays, and in my defence, it's 
in the docstring, so I wouldn't call it a bug. However, it's a 
reasonable expectation that it support rgb and rgba since it is 
basically a thin wrapper around figimage.
My first try at this was to change the line
fig = Figure(figsize=arr.shape[::-1], dpi=1, frameon=False)
to
fig = Figure(figsize=(arr.shape[1],arr.shape[0]), dpi=1, frameon=False)
since we just want to take the first two shape values.
(note figsize=arr.shape[:2][::-1] also works)
This may be all you need. My tests (in the attached test.py) appear to 
work. However, I don't think it's what you want. By default, figimage 
even expects NxMx3 and NxMx4 arrays to be float arrays nominally ranging 
from 0-1. What you probably want is a raw RGB mapping where pixel planes 
 are unsigned 8 bit values. I thought calling figimage with a 
norm=no_norm(0,255) instance achieved this but it doesn't work as I 
expect. So the first question is, what is the expected behaviour here, 
and a follow-up is does anyone here understand how to do the colour 
mapping to achieve it?
Gary
Stéfan van der Walt wrote:
> Hey all,
> 
> 2009年2月10日 Andrew Straw <str...@as...>:
>> Gary Ruben wrote:
>>> Hi Andrew,
>>>
>>> I don't have commit access. If you would check it in, that would be great.
>> Committed to the trunk in r6899... Thanks!
>>
>> And, sheesh, SourceForge's SVN server is slooow today for me, although
>> it seems to have finally improved.
> 
> While trying to write a matplotlib plugin for scikits.image, we
> noticed that `imsave` isn't currently working (that goes for the one
> in Ubuntu [0.99 I think] as well as the latest SVN):
> 
> Traceback (most recent call last):
> File "test_imsave.py", line 6, in <module>
> plt.imsave('test.jpg', img)
> File "/Users/stefan/lib/python2.6/site-packages/matplotlib/pyplot.py",
> line 1412, in imsave
> return _imsave(*args, **kwargs)
> File "/Users/stefan/lib/python2.6/site-packages/matplotlib/image.py",
> line 1025, in imsave
> fig = Figure(figsize=arr.shape[::-1], dpi=1, frameon=False)
> File "/Users/stefan/lib/python2.6/site-packages/matplotlib/figure.py",
> line 180, in __init__
> self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)
> TypeError: from_bounds() takes exactly 4 arguments (5 given)
> 
> The commands needed to reproduce the error are:
> 
> import matplotlib.pyplot as plt
> import numpy as np
> 
> img = np.ones((50, 50, 3), dtype=np.uint8)
> 
> plt.imsave('test.jpg', img)
> 
> Regards
> Stéfan
> 

Showing 6 results of 6

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /