This presentation demonstrates how interactive plots can help us understand global population trends.
Created on: July 13, 2026
We will visualize population data for selected countries.
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
countries <- c("India", "USA", "China", "Japan", "Brazil")
population <- c(1438000000,
340000000,
1410000000,
123000000,
216000000)
data <- data.frame(
Country = countries,
Population = population
)
data
plot <- plot_ly(
data,
x = ~Country,
y = ~Population,
type = "bar",
text = ~paste(Country, "Population:", Population),
hoverinfo = "text"
)
plot
## Warning: `arrange_()` was deprecated in dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
Interactive visualizations allow users to:
Plotly makes data storytelling more engaging.