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

Update coloring for graphs #1056

Merged
merged 7 commits into from
Jul 18, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions darts/utils/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ def plot_acf(
bartlett_confint: bool = True,
fig_size: Tuple[int, int] = (10, 5),
axis: Optional[plt.axis] = None,
default_colors: bool = True,
) -> None:
"""
Plots the ACF of `ts`, highlighting it at lag `m`, with corresponding significance interval.
Expand All @@ -597,6 +598,8 @@ def plot_acf(
The size of the figure to be displayed.
axis
Optionally, an axis object to plot the ACF on.
default_colors
Whether or not to use the darts default scheme.

References
----------
Expand Down Expand Up @@ -633,21 +636,26 @@ def plot_acf(
axis.plot(
(i, i),
(0, r[i]),
color=("#b512b8" if m is not None and i == m else "black"),
color=("#b512b8" if m is not None and i == m else "black") if default_colors else None,
lw=(1 if m is not None and i == m else 0.5),
)

# Adjusts the upper band of the confidence interval to center it on the x axis.
upp_band = [confint[lag][1] - r[lag] for lag in range(1, max_lag + 1)]

# Setting color t0 None overrides custom settings
extra_arguments = {}
if default_colors:
extra_arguments["color"] = "#003DFD"

axis.fill_between(
np.arange(1, max_lag + 1),
upp_band,
[-x for x in upp_band],
color="#003DFD",
alpha=0.25,
alpha=0.25 if default_colors else None,
**extra_arguments
)
axis.plot((0, max_lag + 1), (0, 0), color="black")
axis.plot((0, max_lag + 1), (0, 0), color="black" if default_colors else None)


def plot_pacf(
Expand Down