0% found this document useful (0 votes)
115 views4 pages

Plotting Technique Purpose

The document describes various chart types including column histograms, scatter charts, 3D area charts, bubble charts, bar charts, column charts, circular area charts, line charts, variable width column charts, tables, and pie charts. It then discusses popular R packages for data visualization including ggplot2, Lattice, highcharter, Leaflet, RColorBrewer, Plotly, sunburstR, RGL, and dygraphs. Finally, it provides code to create an animated visualization in R showing transitions in GDP per capita and life expectancy for Asian countries from 1952 to 2007.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views4 pages

Plotting Technique Purpose

The document describes various chart types including column histograms, scatter charts, 3D area charts, bubble charts, bar charts, column charts, circular area charts, line charts, variable width column charts, tables, and pie charts. It then discusses popular R packages for data visualization including ggplot2, Lattice, highcharter, Leaflet, RColorBrewer, Plotly, sunburstR, RGL, and dygraphs. Finally, it provides code to create an animated visualization in R showing transitions in GDP per capita and life expectancy for Asian countries from 1952 to 2007.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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

Column Chart A column chart is a data visualization where each category is represented by a


rectangle, with the height of the rectangle being proportional to the values being plotted

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.

Table A table is the representation of data or information in rows and columns 

Pie Chart a type of graph in which a circle is divided into sectors that each represent a
proportion of the whole.

What are the packages available for data visualization in R?

 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

data <- read.csv("Countries.csv")


retval <- subset( data, continent == "Asia" & year >= 1952 & year<=2007)

print(retval)

#plot(x = retval$gdpPercap,

# y = retval$lifeExp,col=factor(retval$country))

#library(gapminder)

#head(gapminder)

p <- ggplot(

retval,

aes(x = gdpPercap, y=lifeExp, size = pop, colour = country)

)+

geom_point(show.legend = FALSE, alpha = 0.7) +

scale_color_viridis_d() +

scale_size(range = c(2, 12)) +

scale_x_log10() +

labs(x = "GDP per capita", y = "Life expectancy")

p + transition_time(year) +

labs(title = "Year: {frame_time}")


p + facet_wrap(~country) +

transition_time(year) +

labs(title = "Year: {frame_time}")

You might also like