Skip to content

Revisit discussion around precomputed errorbars #3347

Answered by thuiop
JeppeKlitgaard asked this question in Q&A
Discussion options

You must be logged in to vote

I guess you want one of these ?

Code is

import seaborn.objects as so

df = pd.DataFrame({
    "x": [1, 2, 3, 4, 5, 1, 2, 3, 4, 5],
    "y": [1, 2, 3, 4 ,5, 2, 4, 6, 8 ,10],
    "yerr": [0.5, 0.25, 0.5, 0.75, 0.5, 0.25, 0.5, 0.75, 0.5, 0.25],
    "cat": ["A"] * 5 + ["B"] * 5,
})
df["ymin"] = df["y"] - df["yerr"]
df["ymax"] = df["y"] + df["yerr"]
p = (
    so.Plot(data=df, x="x", y="y", color="cat", ymin="ymin", ymax="ymax")
    .add(so.Line())
    .add(so.Range())
)
p.show()

(replace Range by Band to get the other one)

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@JeppeKlitgaard
Comment options

@thuiop
Comment options

@paw-lu
Comment options

Answer selected by JeppeKlitgaard
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #3345 on April 26, 2023 21:12.