INTRODUCTION

This Plot shows data from the World Health Organization, this is the source: http://apps.who.int/gho/data/node.main. Here we can appreciate the relationship between the Gross National Income per capita (GNI) in thousands of dollars and Fertility Rate (FR) number of children, to lower GNI higher FR, this situation occurs in its great majority in African countries, conversely, the countries with higher GNI have lower RF which is mostly in European countries except for Qatar that belongs to the Eastern Mediterranean. The size of the circles depends on the Life Expectancy (LF). We see a direct relationship between LF and GNI and inverse between LF and FR as expected.

knitr::opts_chunk$set(echo = TRUE, results = "hide")
library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
who <- read.csv("WHO.csv", header = TRUE)
m <- list(l = 50, r = 50, b = 100, t = 100, pad = 4)

plot_ly(who, x = ~GNI, y = ~FertilityRate, mode = "markers", hoverinfo = 'text', text = ~paste('</br> Country: ', Country, '</br> GNI: ', GNI, '</br> Fertility Rate: ', FertilityRate, '</br> Life Expectancy: ', LifeExpectancy), color = ~as.factor(Region), size = ~LifeExpectancy) %>%
  layout(title = 'GNI and Fertility Rate by Region and Country', xaxis = list(title = 'Gross National Income per Capita ($ Thousands)'), yaxis = list(title = 'Fertility Rate (# Children)')) %>%
  layout(autosize = F, width = 900, height = 600, margin = m)
## Warning: Specifying width/height in layout() is now deprecated.
## Please specify in ggplotly() or plot_ly()
## No trace type specified:
##   Based on info supplied, a 'scatter' trace seems appropriate.
##   Read more about this trace type -> https://plot.ly/r/reference/#scatter
## Warning: Ignoring 35 observations