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

title as parameter for TimeSeries.plot() #2639

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ but cannot always guarantee backwards compatibility. Changes that may **break co
**Improved**

- New model: `StatsForecastAutoTBATS`. This model offers the [AutoTBATS](https://nixtlaverse.nixtla.io/statsforecast/src/core/models.html#autotbats) model from Nixtla's `statsforecasts` library. [#2611](https://github.com/unit8co/darts/pull/2611) by [He Weilin](https://github.com/cnhwl).
- Added the `title` attribute to `TimeSeries.plot()`. This allows to set a title for the plot. [#2639](https://github.com/unit8co/darts/pull/2639) by [Jonathan Koch](https://github.com/jonathankoch99).
- Added parameter `component_wise` to `show_anomalies()` to separately plot each component in multivariate series. [#2544](https://github.com/unit8co/darts/pull/2544) by [He Weilin](https://github.com/cnhwl).

**Fixed**
Expand Down
5 changes: 4 additions & 1 deletion darts/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -4077,6 +4077,7 @@ def plot(
low_quantile: Optional[float] = 0.05,
high_quantile: Optional[float] = 0.95,
default_formatting: bool = True,
title: Optional[str] = None,
label: Optional[Union[str, Sequence[str]]] = "",
max_nr_components: int = 10,
ax: Optional[matplotlib.axes.Axes] = None,
Expand Down Expand Up @@ -4106,6 +4107,8 @@ def plot(
interval is shown if `high_quantile` is None (default 0.95).
default_formatting
Whether to use the darts default scheme.
title
Optionally, a custom plot title. If `None`, will use the name of the underlying `xarray.DataArray`.
label
Can either be a string or list of strings. If a string and the series only has a single component, it is
used as the label for that component. If a string and the series has multiple components, it is used as
Expand Down Expand Up @@ -4254,7 +4257,7 @@ def plot(
)

ax.legend()
ax.set_title(self._xa.name)
ax.set_title(title if title is not None else self._xa.name)
return ax

def with_columns_renamed(
Expand Down
Loading