xrange calculation

13 views
Skip to first unread message

Adam

unread,
Feb 3, 2009, 4:32:55 AM2/3/09
to pycha
Hello,

I'm looking at the xrange code and it looks unnecessarily complicated.
When the xrange is not defined, PyCha does (chart.py lines 156-160) :

xdata = [pair[0] for pair in reduce(lambda a,b: a+b, stores)
self.minxval = float(min(xdata))
self.maxxval = float(max(xdata))
if self.minxval * self.maxxval > 0 and self.minxval > 0:
self.minxval = 0.0

However, the current input method requires data to be in the form (0,
X), (1, Y), (2, Z)... so the minxval is always 0 and the maxxval is
always float(len(stores[0]) - 1.0).

Am I way off?

Adam

Nicolas Évrard

unread,
Feb 3, 2009, 5:06:57 AM2/3/09
to py...@googlegroups.com
* Adam [2009-02-03 10:32 +0100]:

I suppose this code is there in case there is negative values
(self.minxval * self.maxxval will be positive only if the sign of
minxval and maxxval are the same).

--
(°> Nicolas Évrard
/ ) Liège - Belgique
^^

Adam Przywecki

unread,
Feb 3, 2009, 5:48:00 AM2/3/09
to py...@googlegroups.com
Hello,

> I suppose this code is there in case there is negative values
> (self.minxval * self.maxxval will be positive only if the sign of
> minxval and maxxval are the same).

I guess negative x values might be useful for some people.

Adam

Reply all
Reply to author
Forward
0 new messages