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

plot.bfast: Better plotting #12

Open
GreatEmerald opened this issue Sep 21, 2018 · 0 comments
Open

plot.bfast: Better plotting #12

GreatEmerald opened this issue Sep 21, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@GreatEmerald
Copy link
Collaborator

GreatEmerald commented Sep 21, 2018

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:

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

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

@GreatEmerald GreatEmerald added enhancement New feature or request help wanted Extra attention is needed labels Sep 21, 2018
@GreatEmerald GreatEmerald self-assigned this Sep 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant