Hi André,
On 29/04/2008, André Wobst <[EMAIL PROTECTED]> wrote:
> Hi Tim,
>
> this is tricky: You need a range-style with an none-default usename
> setting (i.e. it's not obvious, but we already thought about such a
> case). Here a small modified version of the graphstyles/errorbar
> example:
>
> from pyx import *
>
> g = graph.graphxy(width=8)
> g.plot(graph.data.file("errorbar.dat", x=1, y=2, error=2,
> derror=3),
> [graph.style.histogram(), graph.style.range(usenames={"y":
> "error"}), graph.style.errorbar()])
> g.writePDFfile("errorbar")
>
I had looked at the range style because it is mentioned in both
histogram and errorbar but could not quite figure out how to use
usenames, docs read like it should be a dictionary but if you look in
the code you see def range(....., usenames=[], ...).
Maybe we can add an example to the docs of errorbar saying: "if you
want errorbars in a histogram you need to provide your errorbar delta
under a different name. The following code will take care of this:
$your_code" (better english needed)
Out of academic interest, why does adding dy= to my data confuse the
histogram style?
cheers,
tim
> HTH,
>
>
> André
>
>
> Am 29.04.2008 um 00:58 schrieb Tim Head:
>
>
> > Hi
> >
> > I would like to plot a histogram with errorbars. I tried the obvious
> > way, by specifying dy values but that has unexpected results.
> >
> > A quick google didn't yield anything promising ;(
> >
> > The following script demonstrates my problem and my current work
> > around.
> >
> > import pyx
> >
> > d = [1,2,3,4,5,6,7,8,9,10]
> >
> > data = pyx.graph.data.values(x=d, y=d, dy=[2]*len(d), title="data")
> >
> > g = pyx.graph.graphxy(width=8, key=pyx.graph.key.key())
> > g.plot(data, [pyx.graph.style.histogram()])
> > g.writePDFfile("pyx-test")
> >
> > # work around
> > data = pyx.graph.data.values(x=d, y=d, title="data")
> > # empty title to suppres it appearing in the key
> > errors = pyx.graph.data.values(x=d, y=d, dy=[2]*len(d), title="")
> >
> > g = pyx.graph.graphxy(width=8, key=pyx.graph.key.key())
> > g.plot(data, [pyx.graph.style.histogram()])
> > g.plot(errors, [pyx.graph.style.errorbar()])
> > g.writePDFfile("pyx-test")
> >
> > All ideas welcome ;]]
> >
> > tim
> >
> > --
> > http://tim.jottit.com/
> >
>
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> > Don't miss this year's exciting event. There's still time to save
> > $100.
> > Use priority code J8TL2D2.
> >
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> > _______________________________________________
> > PyX-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/pyx-user
> >
>
> --
> by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
> / \ \ / ) [EMAIL PROTECTED], http://www.wobsta.de/
> / _ \ \/\/ / PyX - High quality PostScript and PDF figures
> (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
>
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> PyX-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyx-user
>
--
http://tim.jottit.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user