[PyX-checkins] pyx/pyx/graph/axis axis.py,1.23,1.24 From: André Wobst - 2005-03-30 16:09 ```Update of /cvsroot/pyx/pyx/pyx/graph/axis In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10280/pyx/graph/axis Modified Files: axis.py Log Message: add reverse feature to bar axis Index: axis.py =================================================================== RCS file: /cvsroot/pyx/pyx/pyx/graph/axis/axis.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** axis.py 23 Mar 2005 16:14:33 -0000 1.23 --- axis.py 30 Mar 2005 16:08:52 -0000 1.24 *************** *** 56,60 **** def convert(self, data, value): """axis coordinates -> graph coordinates""" ! return (float(value) - data.min) / (data.max - data.min) --- 56,63 ---- def convert(self, data, value): """axis coordinates -> graph coordinates""" ! if self.reverse: ! return (data.max - float(value)) / (data.max - data.min) ! else: ! return (float(value) - data.min) / (data.max - data.min) *************** *** 65,69 **** """axis coordinates -> graph coordinates""" # TODO: store log(data.min) and log(data.max) ! return (math.log(float(value)) - math.log(data.min)) / (math.log(data.max) - math.log(data.min)) --- 68,75 ---- """axis coordinates -> graph coordinates""" # TODO: store log(data.min) and log(data.max) ! if self.reverse: ! return (math.log(data.max) - math.log(float(value))) / (math.log(data.max) - math.log(data.min)) ! else: ! return (math.log(float(value)) - math.log(data.min)) / (math.log(data.max) - math.log(data.min)) *************** *** 268,272 **** def __init__(self, subaxes=None, defaultsubaxis=linear(painter=None, linkpainter=None, parter=None, texter=None), ! dist=0.5, firstdist=None, lastdist=None, title=None, painter=painter.bar(), linkpainter=painter.linkedbar()): self.subaxes = subaxes --- 274,278 ---- def __init__(self, subaxes=None, defaultsubaxis=linear(painter=None, linkpainter=None, parter=None, texter=None), ! dist=0.5, firstdist=None, lastdist=None, title=None, reverse=0, painter=painter.bar(), linkpainter=painter.linkedbar()): self.subaxes = subaxes *************** *** 282,285 **** --- 288,292 ---- self.lastdist = 0.5 * dist self.title = title + self.reverse = reverse self.painter = painter self.linkpainter = linkpainter *************** *** 305,309 **** data.size += self.dist data.subaxes[name] = subaxis ! data.names.append(name) def adjustaxis(self, data, columndata, errorname): --- 312,319 ---- data.size += self.dist data.subaxes[name] = subaxis ! if self.reverse: ! data.names.insert(0, name) ! else: ! data.names.append(name) def adjustaxis(self, data, columndata, errorname): ```