forecast: autoplot() + autolayer() showing error with monthly time series data

I am practicing structural changes in a time series with strucchange package but I want to plot and customize it with ggplot. so I choose autoplot function from package forecast .
library(strucchange)
library(tidyverse)
library(forecast)

data= monthly_ts #monthly time series data
tt = 1: length(monthly_ts)
bpoint_ts = breakpoints(monthly_ts ~ tt, h=0.1)

autoplot(breakpoints(bpoint_ts,break=6),data=monthly_ts) #this portion runs perfectly

autoplot(breakpoints(bpoint_ts,break=6),data=monthly_ts) + autolayer(fitted(bpoint_ts , breaks = 6),size=0.6 ) #showing error while adding autolayer()
#it is showing "Error: Invalid input: date_trans works with objects of class Date only"
also, everything works perfectly while using same time series but annually averaged .

The return value of breakpoints is

An object of class "breakpoints" is a list with the following elements:

Consider breakdates in its place.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.