Skip to content

df.plot() fails to plot multiple scenario quantiles #951

@zyankarli

Description

@zyankarli

To reproduce:
get upper and lower quantiles of a pyam.IamDataFrame using compute.quantiles()

upper = df.filter(
        **{"variable": "Emissions|Kyoto Gases",
           "year": [2020, 2025, 2030, 2035, 2040]}
    ).compute.quantiles([1.0])

lower = df.filter(
        **{"variable": "Emissions|Kyoto Gases",
        "year": [2020, 2025, 2030, 2035, 2040]}
    ).compute.quantiles([0.0])

band = upper.append(lower)

The resulting band dataframe should look like:
<class 'pyam.core.IamDataFrame'>
Index:

  • model : Quantiles (1)
  • scenario : 0.0, 1.0 (2)
    Timeseries data coordinates:
    region : World (1)
    variable : Emissions|Kyoto Gases (1)
    unit : Mt CO2-equiv/yr (1)
    year : 2020, 2025, 2030, 2035, 2040 (5)

Now run

band.plot()

As a result, only one out of two scenarios ("1.0") is plotted. This bug seems robust against changing scenario and model names of band.

WORKAROUND
Re-defining band as a pyam.IamDataFrame again will allow correct plotting:

band_df = pyam.IamDataFrame(band)
band_df.plot()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions