Plotting Technique Purpose
Plotting Technique Purpose
Column Histogram For Distribution, Single Variable and few data points
Line Histogram
Scatter Chart This chart is between two points or variables. The first variable is independent,
and the second variable is dependent on the first one
3D Area Chart used to represent cumulated totals using numbers or percentages (stacked area
charts in this case) over time
Bubble Chart A bubble chart is a type of chart that displays three dimensions of data. Each
entity with its triplet (v1, v2, v3) of associated data is plotted as a disk that expresses two of the vi values
through the disk's xy location and the third through its size.
Bar Chart a diagram in which the numerical values of variables are represented by the
height or length of lines or rectangles of equal width
Circular Area Chart A Proportional Area Chart (Circle) is used for comparing proportions (size,
quantities, etc.) to provide a quick overview of the relative size of data without the use of scales
Line Chart A line chart is a graphical representation of an asset's historical price action that
connects a series of data points with a continuous line
Variable Width Column Chart is a bar chart where column widths are scaled such that the total width
matches the desired chart width and there are no gaps between columns.
Pie Chart a type of graph in which a circle is divided into sectors that each represent a
proportion of the whole.
ggplot2
Lattice
highcharter
Leaflet
RColorBrewer
Plotly
sunburstR
RGL
dygraphs
Mr. Vante is fond of animations. Being a data analyst, he wanted to make the visualizations more
animated. He was assigned to make visualizations on the GDP per capita and Life Expectancy of Asian
countries from the years 1952 to 2007. He planned to show the transitions in the data yearly by plotting
Life Expectancy against GDP per capital by considering the year and population. As Vante and a
professional data analyst in R, visualize the data just as planned. Note: Run the RStudio as
Administrator d) Install the packages gganimate, gifski for the animations. e) Load the packages and
read the Countries.csv dataset into R. f) Plot the GDP vs Life Expectancy of Asian countries from the data
where each country’s points are plotted with unique colors and the sizes are plotted w.r.t to the
population of the country. (Show the legend of the plot) g) Show the transitions in the plot w.r.t the
year. h) Show the transitions of the plots for each country separately. i) Finally, save the animation with
the name ‘Transitions_plot.gif’.
library(gganimate)
library(gifski )
install.packages('gganimate')
library(ggplot2)
library(gganimate)
theme_set(theme_bw())
#install.packages("sqldf")
#library(sqldf)
print(getwd())
setwd("C:/Users/DATAPRO/Documents")
print(getwd())
# Read in data
print(retval)
#plot(x = retval$gdpPercap,
# y = retval$lifeExp,col=factor(retval$country))
#library(gapminder)
#head(gapminder)
p <- ggplot(
retval,
)+
scale_color_viridis_d() +
scale_x_log10() +
p + transition_time(year) +
transition_time(year) +