Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Dani Marti <daniel.marti@up...>  20050901 09:36:31

Hi everyone, I'd like to thank first the developpers for this nice package. The figures one can generate with PyX are simply impressive, and I hope PyX will improve definitively the quality of published figures in the same way TeX once did with document typesetting. I have to represent different datasets in one single figure. Every dataset consists on a list of points, each with its corresponding error: dataset[0] = [ [x01, y01, dy01], [x02, y02, dy02] ...] dataset[1] = [ [x11, y11, dy11], [x12, y12, dy12] ...] ... I represent these as symbols with error bars. Ignoring any style customization the snippet to achieve this would be something like: fig.plot([graph.data.list(dataset[i], x=1, y=2, dy=3) for i in range(len(dataset_num)], [graph.style.symbol(), graph.style.errorbar()]) Here is my question: I want the datasets to be plotted in different colors. How can I plot the symbols and errorbars with the same color, within a dataset? (this is a sort of symbol+errorbar version of the change.py example given at http://pyx.sourceforge.net/examples/graphs/index.html). I've struggled a bit with the lists, the examples and the documentation but I haven't managed to get an answer. Thanks a lot, dani 
From: Andre Wobst <wobsta@us...>  20050901 16:45:09

Hi, On 01.09.05, Dani Marti wrote: > I have to represent different datasets in one single figure. Every > dataset consists on a list of points, each with its corresponding > error: > > dataset[0] = [ [x01, y01, dy01], [x02, y02, dy02] ...] > dataset[1] = [ [x11, y11, dy11], [x12, y12, dy12] ...] > ... > > I represent these as symbols with error bars. Ignoring any style > customization the snippet to achieve this would be something like: > > fig.plot([graph.data.list(dataset[i], x=1, y=2, dy=3) for i in > range(len(dataset_num)], > [graph.style.symbol(), graph.style.errorbar()]) > > Here is my question: > > I want the datasets to be plotted in different colors. How can I plot > the symbols and errorbars with the same color, within a dataset? (this > is a sort of symbol+errorbar version of the change.py example given at > http://pyx.sourceforge.net/examples/graphs/index.html). > > I've struggled a bit with the lists, the examples and the documentation > but I haven't managed to get an answer. You have to adjust the attributes of all the styles you want to combine. Hence the following should work: fig.plot([graph.data.list(dataset[i], x=1, y=2, dy=3) for i in range(len(dataset_num))], [graph.style.symbol(symbolattrs=[color.palette.Rainbow]), graph.style.errorbar(errorbarattrs=[color.palette.Rainbow])]) When you want to costumize the attributes further, you may use a variable. For example: myattrs = [attr.changelist([color.rgb.red, color.rgb.green])] fig.plot([graph.data.list(dataset[i], x=1, y=2, dy=3) for i in range(len(dataset_num))], [graph.style.symbol(symbolattrs=myattrs), graph.style.errorbar(errorbarattrs=myattrs)]) It's no problem to reuse those attribute components, even when they're changing ... and even when they're changing simultaniously. (I haven't tested the code, since I had no full example ... ;) ... but it should work that way ...) 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/ 
Sign up for the SourceForge newsletter:
No, thanks