SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: Brad C. <bra...@so...> - 2009年06月18日 18:04:07
SUBJECT:
Filtering out 0 bar height/width not working
FILE:
matplotlib/ trunk/ matplotlib/ lib/ matplotlib/ axes.py
PROBLEM:
xmin = np.amin(width[width!=0]) # filter out the 0 width rects
ymin = np.amin(height[height!=0]) # filter out the 0 height rects
These aren't using proper python list comprehension and don't work as expected (for me anyway).
SOLUTION:
Shouldn't they be something like:
xmin = np.amin([w for w in width if w != 0])
ymin = np.amin([h for h in height if h != 0])
Once I changed them they seem to work properly.
Thanks,
Brad
From: Brad C. <bra...@so...> - 2009年06月23日 14:14:30
Anyone? Am I way off the mark here?
Thanks,
Brad
On 2009年6月18日 14:41:03 -0300
Brad Chivari <bra...@so...> wrote:
> SUBJECT:
> Filtering out 0 bar height/width not working
> 
> FILE:
> matplotlib/ trunk/ matplotlib/ lib/ matplotlib/ axes.py
> 
> PROBLEM:
> xmin = np.amin(width[width!=0]) # filter out the 0 width rects
> ymin = np.amin(height[height!=0]) # filter out the 0 height rects
> 
> These aren't using proper python list comprehension and don't work as expected (for me anyway).
> 
> SOLUTION:
> Shouldn't they be something like:
> xmin = np.amin([w for w in width if w != 0])
> ymin = np.amin([h for h in height if h != 0])
> 
> Once I changed them they seem to work properly.
> 
> Thanks,
> Brad
> 
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing 
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Matplotlib-devel mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
From: Michael D. <md...@st...> - 2009年06月23日 14:30:42
What's in there now should work with numpy arrays, but obviously not 
Python lists. I think the correct solution is actually to coerce width 
and height to arrays rather than lists. But I'm hoping someone more 
familiar with the bar code can comment. It should be a simple change to 
"make_iterable"
Cheers,
Mike
Brad Chivari wrote:
> Anyone? Am I way off the mark here?
>
> Thanks,
> Brad
>
> On 2009年6月18日 14:41:03 -0300
> Brad Chivari <bra...@so...> wrote:
>
> 
>> SUBJECT:
>> Filtering out 0 bar height/width not working
>>
>> FILE:
>> matplotlib/ trunk/ matplotlib/ lib/ matplotlib/ axes.py
>>
>> PROBLEM:
>> xmin = np.amin(width[width!=0]) # filter out the 0 width rects
>> ymin = np.amin(height[height!=0]) # filter out the 0 height rects
>>
>> These aren't using proper python list comprehension and don't work as expected (for me anyway).
>>
>> SOLUTION:
>> Shouldn't they be something like:
>> xmin = np.amin([w for w in width if w != 0])
>> ymin = np.amin([h for h in height if h != 0])
>>
>> Once I changed them they seem to work properly.
>>
>> Thanks,
>> Brad
>>
>> ------------------------------------------------------------------------------
>> Crystal Reports - New Free Runtime and 30 Day Trial
>> Check out the new simplified licensing option that enables unlimited
>> royalty-free distribution of the report engine for externally facing 
>> server and web deployment.
>> http://p.sf.net/sfu/businessobjects
>> _______________________________________________
>> Matplotlib-devel mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>> 
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference: 250ドル.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> _______________________________________________
> Matplotlib-devel mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Eric F. <ef...@ha...> - 2009年09月19日 23:54:44
Brad Chivari wrote:
> SUBJECT:
> Filtering out 0 bar height/width not working
> 
> FILE:
> matplotlib/ trunk/ matplotlib/ lib/ matplotlib/ axes.py
> 
> PROBLEM:
> xmin = np.amin(width[width!=0]) # filter out the 0 width rects
> ymin = np.amin(height[height!=0]) # filter out the 0 height rects
> 
> These aren't using proper python list comprehension and don't work as expected (for me anyway).
> 
> SOLUTION:
> Shouldn't they be something like:
> xmin = np.amin([w for w in width if w != 0])
> ymin = np.amin([h for h in height if h != 0])
> 
> Once I changed them they seem to work properly.
I have applied a slight modification to your fix, which seems to me to 
be the right approach, given that the bar implementation is based on 
lists rather than ndarrays.
Thanks.
Eric
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 によって変換されたページ (->オリジナル) /