Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix box plotting to support latest pandas set_categories #891

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions pyam/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
from pyam.run_control import run_control
from pyam.str import is_str
from pyam.timeseries import cross_threshold
from pyam.utils import (
IAMC_IDX,
META_IDX,
SORT_IDX,
YEAR_IDX,
to_list,
)
from pyam.utils import IAMC_IDX, META_IDX, SORT_IDX, YEAR_IDX, to_list

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -711,7 +705,7 @@
# TODO this only works if all categories are defined in run_control
palette = rc["color"][by]
df[by] = df[by].astype("category")
df[by].cat.set_categories(list(palette), inplace=True)
df[by] = df[by].cat.set_categories(list(palette))

Check warning on line 708 in pyam/plotting.py

View check run for this annotation

Codecov / codecov/patch

pyam/plotting.py#L708

Added line #L708 was not covered by tests
kwargs["palette"] = palette
else:
df.sort_values(by, inplace=True)
Expand Down
Loading