From: Andrea R. <ari...@pi...> - 2005-01-24 11:31:47
|
Hi, I was trying a simple plot, when I realized that PyX doesn't allow to plot horizontal line expressed as analitic function. Here it is a simple example: > In [197]: h = pyx.graph.graphxy(width = 10, height = 10, x = > pyx.graph.axis.lin(min = 0, max = 10), y = pyx.graph.axis.lin(min = 0, > max = 10)) > > In [198]: h.plot(pyx.graph.data.function("y = x")) > Out[198]: <pyx.graph.graph.plotitem instance at 0x6e80558> > > In [199]: h.plot(pyx.graph.data.function("y = 2")) > ----------------------------------------------------------------------- > ---- > ValueError Traceback (most recent call > last) > > /Users/andrea/Documents/Dottorato/Working/<console> > > /sw/lib/python2.3/site-packages/pyx/graph/graph.py in plot(self, data, > styles) > 231 plotitems = [] > 232 for d in usedata: > --> 233 plotitems.append(plotitem(self, d, styles)) > 234 self.plotitems.extend(plotitems) > 235 if singledata: > > /sw/lib/python2.3/site-packages/pyx/graph/graph.py in __init__(self, > graph, data, styles) > 170 > 171 # perform setcolumns to all styles > --> 172 self.data.initplotitem(self, graph) > 173 columns = self.data.getcolumnnames(self) > 174 usedcolumns = [] > > /sw/lib/python2.3/site-packages/pyx/graph/data.py in > initplotitem(self, plotitem, graph) > 617 raise ValueError("multiple variables > found") > 618 if self.xname is None: > --> 619 raise ValueError("no variable found") > 620 plotitem.columns = {self.xname: 0, self.yname: 1} > 621 > > ValueError: no variable found There is a trick that I can use to get the desired result? Could this feature be embeded in a future version of PyX? Thanks, Andrea. |