Skip to content

No upper outline in geom_ribbon()  #728

@MathisC22

Description

@MathisC22

When adding prediction intervals to my plot via geom_ribbon(), I noticed that geom_ribbon() does not add an outline to the upper end of the shaded area when setting either outline_type="both" or outline_type="upper". It works, however, when setting outline_type="full".

Reproducible example:

from plotnine import * 
import polars as pl 

df = pl.DataFrame({
    "x": [1, 2, 3, 4, 5],
    "y": [100, 120, 90, 105, 115],
    "lower": [90, 110, 80, 95, 105],
    "upper": [110, 130, 100, 115, 125]
})

(
    ggplot(df, aes(x="x", y="y")) 
    + geom_line() 
    + geom_ribbon(
        aes(ymin="lower", ymax="upper"),
        alpha=0.3,
        color="red",
        fill="gray",
        outline_type="both"
    )
)

This leads to a shaded area with only an outline in the lower part:
grafik

Using plotnine 0.12.4 and mizani 0.9.3 on Python 3.11.5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions