Have fixed ordering for components plots

This commit is contained in:
Ben Letham 2018-12-03 20:14:24 -08:00
parent 52bbb08dee
commit 635ae5a1a6
2 changed files with 12 additions and 3 deletions

View file

@ -113,7 +113,7 @@ prophet_plot_components <- function(
panels[[length(panels) + 1]] <- plot_yearly(m, uncertainty, yearly_start)
}
# Plot other seasonalities
for (name in names(m$seasonalities)) {
for (name in sort(names(m$seasonalities))) {
if (!(name %in% c('weekly', 'yearly')) &&
(name %in% colnames(fcst))) {
panels[[length(panels) + 1]] <- plot_seasonality(m, name, uncertainty)

View file

@ -105,8 +105,17 @@ def plot_components(
components = ['trend']
if m.train_holiday_names is not None and 'holidays' in fcst:
components.append('holidays')
components.extend([name for name in m.seasonalities
if name in fcst])
# Plot weekly seasonality, if present
if 'weekly' in m.seasonalities and 'weekly' in fcst:
components.append('weekly')
# Yearly if present
if 'yearly' in m.seasonalities and 'yearly' in fcst:
components.append('yearly')
# Other seasonalities
components.extend([
name for name in sorted(m.seasonalities)
if name in fcst and name not in ['weekly', 'yearly']
])
regressors = {'additive': False, 'multiplicative': False}
for name, props in m.extra_regressors.items():
regressors[props['mode']] = True