SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: TP <par...@fr...> - 2009年09月29日 09:26:46
Hi everybody,
I try to play with "sharex" feature. Then, I have been guided to the
class "Grouper" of module cbook:
http://matplotlib.sourceforge.net/api/cbook_api.html
So I tried the following example:
##############################
from matplotlib.cbook import *
g = Grouper()
g.join('a', 'b')
##############################
I obtain:
Traceback (most recent call last):
 File "test_grouper.py", line 4, in <module>
 g.join('a', 'b')
 File ".../matplotlib/cbook.py", line 1118, in join
 set_a = mapping.setdefault(ref(a), [ref(a)])
TypeError: cannot create weak reference to 'str' object
What is the problem?
Thanks in advance,
Julien
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
From: Eric F. <ef...@ha...> - 2009年09月29日 21:42:37
TP wrote:
> Hi everybody,
> 
> I try to play with "sharex" feature. Then, I have been guided to the
> class "Grouper" of module cbook:
> 
> http://matplotlib.sourceforge.net/api/cbook_api.html
> 
> So I tried the following example:
> 
> ##############################
> from matplotlib.cbook import *
> 
> g = Grouper()
> g.join('a', 'b')
> ##############################
> 
> I obtain:
> 
> Traceback (most recent call last):
> File "test_grouper.py", line 4, in <module>
> g.join('a', 'b')
> File ".../matplotlib/cbook.py", line 1118, in join
> set_a = mapping.setdefault(ref(a), [ref(a)])
> TypeError: cannot create weak reference to 'str' object
> 
> What is the problem?
Grouper is implemented using weak references, which are supported only 
for some types of objects, as described here:
http://docs.python.org/library/weakref.html
Evidently the cbook Grouper docstring was written when the 
implementation was different, and did not use weakref. So, you have 
found a major bug in the docstring.
Eric
> 
> Thanks in advance,
> 
> Julien
> 
From: Michael D. <md...@st...> - 2009年09月30日 13:25:43
Yes -- I'll update the docstring. The weakref support was added 
afterward during one of my many memory leak crusades ;)
What were you attempting to do with the Grouper? You shouldn't have to 
use the class directly to use the sharex/sharey functionality -- it's 
only an implementation detail.
Mike
Eric Firing wrote:
> TP wrote:
> 
>> Hi everybody,
>>
>> I try to play with "sharex" feature. Then, I have been guided to the
>> class "Grouper" of module cbook:
>>
>> http://matplotlib.sourceforge.net/api/cbook_api.html
>>
>> So I tried the following example:
>>
>> ##############################
>> from matplotlib.cbook import *
>>
>> g = Grouper()
>> g.join('a', 'b')
>> ##############################
>>
>> I obtain:
>>
>> Traceback (most recent call last):
>> File "test_grouper.py", line 4, in <module>
>> g.join('a', 'b')
>> File ".../matplotlib/cbook.py", line 1118, in join
>> set_a = mapping.setdefault(ref(a), [ref(a)])
>> TypeError: cannot create weak reference to 'str' object
>>
>> What is the problem?
>> 
>
> Grouper is implemented using weak references, which are supported only 
> for some types of objects, as described here:
> http://docs.python.org/library/weakref.html
>
> Evidently the cbook Grouper docstring was written when the 
> implementation was different, and did not use weakref. So, you have 
> found a major bug in the docstring.
>
> Eric
>
> 
>> Thanks in advance,
>>
>> Julien
>>
>> 
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: TP <par...@fr...> - 2009年09月30日 15:46:51
Michael Droettboom wrote:
> Yes -- I'll update the docstring. The weakref support was added
> afterward during one of my many memory leak crusades ;)
> 
> What were you attempting to do with the Grouper? You shouldn't have to
> use the class directly to use the sharex/sharey functionality -- it's
> only an implementation detail.
I have not found any way to share an axis after the creation of the
subplot/axis. That is why I use the "join" method of a Grouper after the
subplot/axis has been created. But I would need also a means to "unjoin"
the subplots. Is it possible?
Thanks
Julien
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
From: Michael D. <md...@st...> - 2009年09月30日 17:33:29
You can use the twinx/twiny methods to join two axes after they've been 
created.
I don't think we currently provide a way to unjoin the subplots (either 
in the axes or in the Grouper class itself.) I think that's 
functionality we would need to add. If you can be so kind as to add a 
feature request to the tracker, it won't get lost.
Mike
TP wrote:
> Michael Droettboom wrote:
>
> 
>> Yes -- I'll update the docstring. The weakref support was added
>> afterward during one of my many memory leak crusades ;)
>>
>> What were you attempting to do with the Grouper? You shouldn't have to
>> use the class directly to use the sharex/sharey functionality -- it's
>> only an implementation detail.
>> 
>
> I have not found any way to share an axis after the creation of the
> subplot/axis. That is why I use the "join" method of a Grouper after the
> subplot/axis has been created. But I would need also a means to "unjoin"
> the subplots. Is it possible?
>
> Thanks
>
> Julien
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: TP <par...@fr...> - 2009年10月01日 09:35:39
Michael Droettboom wrote:
> You can use the twinx/twiny methods to join two axes after they've been
> created.
> 
> I don't think we currently provide a way to unjoin the subplots (either
> in the axes or in the Grouper class itself.) I think that's
> functionality we would need to add. If you can be so kind as to add a
> feature request to the tracker, it won't get lost.
It is done!
Thanks
Julien
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
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 によって変換されたページ (->オリジナル) /