From: Carl Bolduc <drcurl@gm...>  20060725 15:33:56
Attachments:
Message as HTML

Hi, I'm using Pyx to plot this file: ________________________________________________________ SAGE Q_RTPCR Genes 9.61 22.36 Adiponectin 5.73 19.16 AcylCoenzyme A dehydrogenase, very long chain 8.46 21.25 1acylglycerol3phosphate Oacyltransferase 2 10.68 26.45 Fatty acid synthase 8.53 23.44 Lipoprotein lipase 9.39 23.77 Cell deathinducing DFFAlike effector c 5 20.65 Angiotensinogen 7.73 23.93 Neuronatin ________________________________________________________ My actual script looks like this: ________________________________________________________ from pyx import * g = graph.graphxy(width=8, x=graph.axis.lin(min=15, max=15, title="SAGE"), y=graph.axis.lin(min=30, max=30, title="RTPCR"), ) g.plot(graph.data.file("explevels.dat", x=1, y=2)) g.writeEPSfile("minimal") g.writePDFfile("minimal") ________________________________________________________ I would like to add a legend for each of the point. So each point should have a different shape and/or color and the legend should correspond to the 3rd column of the input file (Genes). How should I proceed? Thanks, Carl 
From: Andre Wobst <wobsta@us...>  20060725 16:41:49

Hi Carl, On 25.07.06, Carl Bolduc wrote: > I'm using Pyx to plot this file: > ________________________________________________________ > SAGE Q_RTPCR Genes > 9.61 22.36 Adiponectin > 5.73 19.16 AcylCoenzyme A dehydrogenase, very long chain > 8.46 21.25 1acylglycerol3phosphate Oacyltransferase 2 > 10.68 26.45 Fatty acid synthase > 8.53 23.44 Lipoprotein lipase > 9.39 23.77 Cell deathinducing DFFAlike effector c > 5 20.65 Angiotensinogen > 7.73 23.93 Neuronatin > ________________________________________________________ Let me first change this data file to become:  #SAGE Q_RTPCR Genes 9.61 22.36 Adiponectin 5.73 19.16 "AcylCoenzyme A dehydrogenase, very long chain" 8.46 21.25 "1acylglycerol3phosphate Oacyltransferase 2" 10.68 26.45 "Fatty acid synthase" 8.53 23.44 "Lipoprotein lipase" 9.39 23.77 "Cell deathinducing DFFAlike effector c" 5 20.65 Angiotensinogen 7.73 23.93 Neuronatin  By that the third column will properly contain the full strings. (You can always ass the double quotes, but when having spaces you'll need them. Or you could read/provide the data yourself ...) > My actual script looks like this: > ________________________________________________________ > from pyx import * > > g = graph.graphxy(width=8, > x=graph.axis.lin(min=15, max=15, title="SAGE"), > y=graph.axis.lin(min=30, max=30, title="RTPCR"), > ) > > g.plot(graph.data.file("explevels.dat", x=1, y=2)) > g.writeEPSfile("minimal") > g.writePDFfile("minimal") > ________________________________________________________ > > I would like to add a legend for each of the point. So each point should > have a different shape and/or color and the legend should correspond to the > 3rd column of the input file (Genes). > > How should I proceed? At first you might consider to label the dots itself. This might be a solution in certain cases. However, your case doesn't look well. Anyway, the corresponding code would look like:  from pyx import * g = graph.graphxy(width=8, x=graph.axis.lin(min=15, max=15, title="SAGE"), y=graph.axis.lin(min=30, max=30, title="RTPCR"), ) g.plot(graph.data.file("explevels.dat", x=1, y=2, text=3), [graph.style.symbol(), graph.style.text()]) g.writeEPSfile("minimal")  But back to what you really want: Unfortunately due to some missing features in the graph key system, we currently can have a single graph key item per data set only (but this is already on my todo list). On the other hand you want to alter the symbols as well. You could do this by an own graph style. Or by using a set of data instances and the usual symbol style. So lets try this, since it also solves the graph key problem:  from pyx import * d = graph.data.file("explevels.dat", x=1, y=2, text=3) ds = [graph.data.list([(x, y)], x=1, y=2, title=text) for x, y, text in zip(d.columns['x'], d.columns['y'], d.columns['text'])] g = graph.graphxy(width=8, key=graph.key.key(), x=graph.axis.lin(min=15, max=15, title="SAGE"), y=graph.axis.lin(min=30, max=30, title="RTPCR"), ) g.plot(ds) g.writeEPSfile("minimal")  (You may want to add a list of symbols. IIRC Arnd Bäcker wrote quite a nice set of symbols. See http://www.physik.tudresden.de/~baecker/python/pyxgraph.html ... maybe you can up some of the symbols code. And we may add some to the PyX core, but that's a different story.) So the code above may work for you for the moment. Beside that I promise to add some functionality to the graph keys to allow for several key items per data+style instance (i.e. plotitem instance). We'll need that for other styles as well (like the changebar) and we want to at least be able to hide that in some proper graph styles ... HTH, André  by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX  High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ 
From: Carl Bolduc <drcurl@gm...>  20060725 17:14:23
Attachments:
Message as HTML

Hi! On 7/25/06, Andre Wobst <wobsta@...> wrote: > > > > At first you might consider to label the dots itself. This might be a > solution in certain cases. However, your case doesn't look well. > Anyway, the corresponding code would look like: > >  > from pyx import * > > g = graph.graphxy(width=8, > x=graph.axis.lin(min=15, max=15, title="SAGE"), > y=graph.axis.lin(min=30, max=30, title="RTPCR"), > ) > > g.plot(graph.data.file("explevels.dat", x=1, y=2, text=3), [ > graph.style.symbol(), graph.style.text()]) > g.writeEPSfile("minimal") >  This might work, if I abreviate the names, and extend the lenght of the axis. But back to what you really want: Unfortunately due to some missing > features in the graph key system, we currently can have a single graph > key item per data set only (but this is already on my todo list). On > the other hand you want to alter the symbols as well. You could do > this by an own graph style. Or by using a set of data instances and > the usual symbol style. So lets try this, since it also solves the > graph key problem: > >  > from pyx import * > > d = graph.data.file("explevels.dat", x=1, y=2, text=3) > ds = [graph.data.list([(x, y)], x=1, y=2, title=text) > for x, y, text in zip(d.columns['x'], d.columns['y'], d.columns > ['text'])] > > g = graph.graphxy(width=8, key=graph.key.key(), > x=graph.axis.lin(min=15, max=15, title="SAGE"), > y=graph.axis.lin(min=30, max=30, title="RTPCR"), > ) > > g.plot(ds) > g.writeEPSfile("minimal") >  Looks like what I need, but the layout is a mess... Can you point me to the doc which explains how to position different items (graph and legend) from one another? Thanks! carl 
From: Andre Wobst <wobsta@us...>  20060728 13:43:07

Hi Carl, On 25.07.06, Carl Bolduc wrote: > Looks like what I need, but the layout is a mess... Can you point me to the > doc which explains how to position different items (graph and legend) from > one another? The graph key constructor has a couple of config options. See http://pyx.sourceforge.net/manual/modulegraph.key.html You could for example set hinside to zero to get the key beside the graph. BTW the position of the text (by graph.style.text()) is also configurable. See http://pyx.sourceforge.net/manual/modulegraph.style.html Unfortunately there is no option to position the text for different symbols at a different direction. (You could create an own style along the lines of graph.style.text, but by default we don't have such an option. Hey, let me add this to the todo, since its easy to do and could help in certain cases ...) Best, André  by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX  High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ 
From: Carl Bolduc <drcurl@gm...>  20060725 18:55:09
Attachments:
Message as HTML

Ok, I think I have what I want now: ______________________________________________ from pyx import * g = graph.graphxy(width=20, x=graph.axis.lin(min=15, max=15, title="SAGE"), x2=None, y=graph.axis.lin(min=28, max=28, title="RTPCR"), y2=None ) #g.plot(graph.data.file("explevels.dat", x=1, y=2)) g.plot(graph.data.file("explevels.dat", x=1, y=2, text=3), [ graph.style.symbol(), graph.style.text()]) g.writeEPSfile("minimal") g.writePDFfile("minimal") ______________________________________________ To make it perfect, could I add the "y=x" function to this graph? Thanks again, you'll be in my PhD acknowledgements ;) carl 
From: Alan G Isaac <aisaac@am...>  20060725 19:07:55

On Tue, 25 Jul 2006, Carl Bolduc apparently wrote: > To make it perfect, could I add the "y=x" function to this graph? Many ways, but you seem interested in graph.data.function http://pyx.sourceforge.net/manual/modulegraph.data.html Just plot as many times as you want, plotting last what you want on top. Cheers, Alan Isaac 
From: Andre Wobst <wobsta@us...>  20060726 09:57:52

Hi Carl, On 25.07.06, Carl Bolduc wrote: > from pyx import * > > g = graph.graphxy(width=20, > x=graph.axis.lin(min=15, max=15, title="SAGE"), > x2=None, > y=graph.axis.lin(min=28, max=28, title="RTPCR"), > y2=None > ) > > #g.plot(graph.data.file("explevels.dat", x=1, y=2)) > g.plot(graph.data.file("explevels.dat", x=1, y=2, text=3), [ > graph.style.symbol(), graph.style.text()]) > > g.writeEPSfile("minimal") > g.writePDFfile("minimal") > ______________________________________________ > > To make it perfect, could I add the "y=x" function to this graph? Why don't you just add this as a function? I.e. plot(graph.data.function("y(x)=x")) HTH, André  by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX  High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ 