Plot of diagnostic metrics linked to data trajectories
Source:R/plot_metric_linkview.R
plot_metric_linkview.Rd
Creates an interactive plot linking the scatterplot of two selected metrics with data trajectories. The scatterplot showing the relationship between specified metrics are presented in one panel, and the data trajectories are presented in another panel. Hovering over a point in the scatterplot highlights the corresponding trajectory with the country name, and vice versa.
Arguments
- wdi_data
A data frame of the indicator data generated by
get_wdi_data
- index
A character string specifying the indicator code Defaults to
NULL
- metric_summary
A data frame containing computed diagnostic metrics and the pre-defined grouping information, generated by passing the output of any diagnostic metrics function to
add_group_info
- metric_var
A vector of character strings specifying metric variable names in
metric_summary
- group_var
A grouping variable in the WDI data set (e.g., "region" or "income") Default to
NULL
IfNULL
, both plots are ungrouped and if specified, they are grouped by the levels of the specified grouping variable
Value
An ungrouped or grouped interactive girafe
object displaying the two panels, one with the scatterplot of two specified metrics and the other with the data trajectories.
Examples
pm_diagnostic_metrics <- compute_diagnostic_indices(pm_data, group_var = "region")
pm_diagnostic_metrics_group <- add_group_info(metric_summary = pm_diagnostic_metrics,pm_data)
plot_metric_linkview(pm_data, metric_summary = pm_diagnostic_metrics,
metric_var = c("linearity", "curvature"))