Skip to content

Error bars incorrect for Gamma-Gamma model #10

Description

@Dekermanjian

Hello, first let me say I really appreciate the quality of work you put into your blog. I was going through your post on the Gamma-Gamma model (https://juanitorduz.github.io/gamma_gamma_pymc/) and noticed something was weird with the error bars. Then I found out that Mattplotlib handles the error bars in a weird manner. They are actually +/- relative to the data. This was making your error bars much wider than they are supposed to be. Here is a quick and simple fix to get the proper width.

fig, ax = plt.subplots(figsize=(8, 8))
y = pymc_ceap.mean(axis=0)
err = az.hdi(ary=pymc_ceap, hdi_prob=0.8).T
offsets = np.abs(err - y[None, :])
ax.errorbar(
    x=ggf_ceap,
    y=y,
    yerr=offsets,
    fmt="o",
    ecolor="C6",
    markeredgecolor="C1",
    markerfacecolor="C1",
    markersize=5,
    alpha=0.5,
    capsize=2,
)
ax.axline(
    xy1=(0, 0),
    slope=1,
    color="black",
    linestyle="--",
    label="diagonal"
)
ax.legend(loc="upper left")
ax.set(title="Model Comparison", xlabel="lifetimes", ylabel="pymc");

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions