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
Anyone? Am I way off the mark here?
Thanks,
Brad
···
On Thu, 18 Jun 2009 14:41:03 -0300 Brad Chivari <brad.chivari@...731...> 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
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
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 Thu, 18 Jun 2009 14:41:03 -0300 > Brad Chivari <brad.chivari@...731...> 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
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
------------------------------------------------------------------------------
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
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
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