May 10, 2020

Abstract

This is an R Markdown presentation of Coursera’s DDP week 3 assignment.
This presentation consists of:
- Loading “discoveries” data
- Mutating data
- Presenting data in the plot using plotly

The data discovery is a Time Series data - count of the most important discoveries made by humanity between 1860 to 1959

Loading data and preparing plot

as.data.frame(x = discoveries)->dfd
dfd$year<-seq(1860, 1959)

Preparing labels for the plot:

ax <- list(
  zeroline = TRUE,
  showline = TRUE,
  gridwidth = 1,
  zerolinecolor = toRGB("red"),
  zerolinewidth = 1,
  linecolor = toRGB("black"),
  linewidth = 1,
  title="Year"
)
ay<-list(title="Num of discoveries")

Plot commands

# Plot 1
plot_ly(dfd, x=~year, y=~x, type="scatter", 
        size=~exp(x), color=~factor(year%%10)) %>% 
  layout(xaxis=ax, yaxis=ay)
# Plot 2
plot_ly(dfd, x=~year, y=~x, type="scatter", mode="lines", 
        color=~factor(year%%10)) %>% 
  layout(xaxis=ax, yaxis=ay)

First plot shows bubbles by number of imporant discoveries in particular year.
Second plot connects the years having same last digit, ie 1862-1872-1882 and so on.

Number of important discoveries

Note, legend shows last digit of year.

Plot of same last-digit of year

Note, legend shows last digit of year.