Skip to contents

Plots every country as a bubble, at its value of indicator1 (x) and of indicator2 (y), sized by its population and colored by its region, animated over Year, for the Scatterplot tab. The region comes from country_code, by matching its Short Name to the Country Name of mfi; a country whose names differ there has no region and is left out, as is a country-year without both values and the population.

Usage

plot_cor(mfi, country_code, indicator1, indicator2, font_style)

Arguments

mfi

Data frame of World Bank indicator values (long format, with Country Name, Indicator Name, Year, value columns). Must also contain a "Population, total" indicator, used for bubble sizing.

country_code

Data frame mapping countries to region, with columns Country Code, Short Name, Region.

indicator1

Character. Indicator name plotted on the x-axis.

indicator2

Character. Indicator name plotted on the y-axis.

font_style

A plotly font list for the layout of the chart; the app passes font_style.

Value

A plotly htmlwidget.

Examples

plot_cor(
  mfi,
  country_code,
  indicator1 = "Mortality rate, adult, male (per 1,000 male adults)",
  indicator2 = "Mortality rate, infant (per 1,000 live births)",
  font_style = font_style
)