How do I draw the line for change-point detection using/after doing a Pettitt test.

We need a reproducible example (reprex)

Any particular reason for using matplot?

When I try this

x = (2004:2019)

y = integer(19)

y = as.double(y)


matplot(x, y, type="b", lty=4, pch = 18, col="blue",xlab="Year",
        ylab="Total Emission",main = "Building Sector 2004-2019", lwd = '3')

all I get is a flat line with y == 0