Update plotly_helper.py

This commit is contained in:
teh_coderer
2023-05-04 11:39:06 -04:00
parent 53ba749743
commit 61093518b3

View File

@@ -78,6 +78,12 @@ class TerminalStyle:
line_width: float = 1.5
def __new__(cls, *args, **kwargs): # pylint: disable=W0613
"""Create a singleton."""
if not hasattr(cls, "instance"):
cls.instance = super().__new__(cls) # pylint: disable=E1120
return cls.instance
def __init__(
self,
plt_style: Optional[str] = "",
@@ -247,8 +253,9 @@ class TerminalStyle:
list
List of colors e.g. ["#00ACFF", "#FF0000"]
"""
self.apply_style()
colors = self.plotly_template.get("layout", {}).get("colorway", PLT_COLORWAY)
colors = (
self.plotly_template.get("layout", {}).get("colorway", PLT_COLORWAY).copy()
)
if reverse:
colors.reverse()
return colors