# Example 1: Visualize imputation by na_mean
imp_mean <- na_mean(tsAirgap)
ggplot_na_imputations(tsAirgap, imp_mean)
# Example 2: Visualize imputation by na_locf and added ground truth
imp_locf <- na_locf(tsAirgap)
ggplot_na_imputations(x_with_na = tsAirgap,
x_with_imputations = imp_locf,
x_with_truth = tsAirgapComplete
)
# Example 3: Visualize imputation by na_kalman
imp_kalman <- na_kalman(tsAirgap)
ggplot_na_imputations(x_with_na = tsAirgap, x_with_imputations = imp_kalman)
# Example 4: Same as example 1, just written with pipe operator
tsAirgap %>%
na_mean() %>%
ggplot_na_imputations(x_with_na = tsAirgap)
# Example 5: Visualize imputation by na_seadec - different color for imputed points
# Plot adjustments via ggplot_na_imputations function parameters
imp_seadec <- na_seadec(tsAirgap)
ggplot_na_imputations(x_with_na = tsAirgap,
x_with_imputations = imp_seadec,
color_imputations = "gold")
# Example 6: Visualize imputation - different theme, point size imputations
# Plot adjustments via ggplot_na_imputations function parameters
imp_seadec <- na_seadec(tsAirgap)
ggplot_na_imputations(x_with_na = tsAirgap,
x_with_imputations = imp_seadec,
theme = ggplot2::theme_classic(),
size_imputations = 5)
# Example 7: Visualize imputation - title, subtitle in center
# Plot adjustments via ggplot2 syntax
imp_seadec <- na_seadec(tsAirgap)
ggplot_na_imputations(x_with_na = tsAirgap, x_with_imputations = imp_seadec) +
ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) +
ggplot2::theme(plot.subtitle = ggplot2::element_text(hjust = 0.5))
# Example 8: Visualize imputation - title in center, no subtitle
# Plot adjustments via ggplot2 syntax and function parameters
imp_mean <- na_mean(tsAirgap)
ggplot_na_imputations(x_with_na = tsAirgap,
x_with_imputations = imp_mean,
subtitle = NULL) +
ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5))
Run the code above in your browser using DataLab