View source: R/ptt_plot_base.R
ptt_plot_add_prediction | R Documentation |
Outputs a plotly object.
ptt_plot_add_prediction(
p,
pred_data,
grouping = sarja_nmi,
n_obs = 2,
with_labs = T,
showlegend = F,
hovertext = list(rounding = 1, unit = "", extra = "(ennuste)", dateformat = "Annual"),
value_multiplier = 1,
custom_pred_data = FALSE,
satovuosi = FALSE
)
p |
Plotly object created with ptt_plot to add prediction traces to. |
pred_data |
Tibble in ptt prediction data format. |
grouping |
Tibble column used for grouping in plot, should be labeled the same as data used for parent ptt_plot. |
n_obs |
Number of observations (counted from the latest) used from the prediction set pred_data. |
showlegend , with_labs |
Controls prediction trace legend. Hovertemplate takes labeling based on with_labs. |
hovertext |
A list describing hovertext items "list(rounding = 1, unit = "%", extra = "(ennuste)")". |
value_multiplier |
A number. Value of 0.001 would cause values to be divided by 1000, value of 1000 would cause values to be multiplied by 1000 hovertext items "list(rounding = 1, unit = "%", extra = "(ennuste)")". |
custom_pred_data |
A boolean. If set to true, pred_data is required to be a dataframe/tibble with columns, year, sarja_nmi and value. With two prediction values per sarja_nmi. |
plotly object
e <- readxl::read_excel("ptt_ennusteet_KT.xlsx") |> dplyr::filter(stringr::str_detect(filter, "B1GMH|P3KS14"))
p <- p |> ptt_plot_add_prediction(e)
p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.