diff --git a/plotnine/_utils/context.py b/plotnine/_utils/context.py index 4b7a34fa0..a330adfdd 100644 --- a/plotnine/_utils/context.py +++ b/plotnine/_utils/context.py @@ -1,6 +1,6 @@ from __future__ import annotations -from copy import copy +from copy import copy, deepcopy from dataclasses import dataclass from typing import TYPE_CHECKING @@ -73,7 +73,7 @@ def __enter__(self) -> Self: Enclose in matplolib & pandas environments """ - self._last_plot = copy(self.plot) + self._last_plot = deepcopy(self.plot) self.rc_context.__enter__() if PANDAS_LT_3: self.pd_option_context.__enter__()