nredell / forecastML

An R package with Python support for multi-step-ahead forecasting with machine learning and deep learning algorithms
Other
130 stars 23 forks source link

Plot colors #39

Open nredell opened 4 years ago

nredell commented 4 years ago

Make plots customizable by passing in the color palette of choice. Also, add examples of how plots can be customized by passing ggplot arguments in plot(, ...). The flexibility will focus on aesthetics and geoms because they can get tricky to modify after the plot has already been built. Labels and themes can be easily modified on the returned plot.

nredell commented 4 years ago

As a first exercise, I'm going to go through the whole package and make all of the plots cyberpunk...all of them. This should help firm up the API so that forecast prediction intervals, line colors, and group colors can be changed to whatever the user wants.

nredell commented 4 years ago

Making progress. New example in README. For objects of class forecastML--which is anything coming out of combine_forecasts()--plots can now take custom colors and alphas for the forecast prediction intervals with plot(my_forecast, interval_fill = c("purple"), interval_alpha = .5).

These are the default settings. If multiple levels are returned from calculate_intervals(), simply supply a length(intervals) vector of hex codes or colors and/or alphas. The first color in the vector specifies the widest prediction interval and then things work their way inward.

This setup is working toward allowing the user to return multiple prediction intervals inside of the user-defined predict() function. Currently, only 1 upper and lower bound can be returned while calculate_intervals() with bootstrapping supports an arbitrary number of levels. This coming flexibility will be good for LSS (location, scale, and shape) models and Bayesian models.

nredell commented 4 years ago

You know what, let's recycle the colors and alphas by default. So entering 1 color or 1 alpha will work as expected with multiple forecast intervals.