bfast2 / bfast2/bfast

plot.bfast: Better plotting

Open
#12 0 comments 0 reactions 1 assignee Claimed by @GreatEmerald View on GitHub
enhancement help wanted
Dominant language
R
Stars
53
Forks
16
PR merge metrics
No merged PRs in 30d

Description

The current plot method in `plot.bfast` shows the components one by one, but there is no way to plot everything in one plot. It would be very convenient to have that.

Here's a small snippet of my custom code that produces pretty nice results:

```R
MyTS = bfastts(ChangedEVITS[9,], dates, "10-day") # Some time series
MyTS = na.approx(MyTS) # This step is optional, just for break-free visualisation
MyBF = bfast(MyTS, GetBreakNumber(dates), season="harmonic", max.iter=3)
MyIter = length(MyBF$output)

MyFit = MyBF$output[[MyIter]]$St + MyBF$output[[MyIter]]$Tt
MyTrend = MyBF$output[[MyIter]]$Tt
MyTimes = as.numeric(time(MyBF$output[[MyIter]]$Tt))
MyTimes = MyTimes[!is.na(MyBF$output[[MyIter]]$Tt)]
MyBreaks = MyTimes[MyBF$output[[MyIter]]$bp.Vt$breakpoints]
plot(MyTS); lines(MyFit, col="blue"); lines(MyTrend, col="green"); abline(v=MyBreaks, col="red")
```

Sample output:
![image](https://user-images.githubusercontent.com/726893/45875131-14b64100-bd97-11e8-903c-edfc4a214389.png)

What's missing is a legend. Suggestions are also welcome!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.