How to create your own visuals

with the SKEMA Quantum Studio Framework

Anne Sophie Gill https://www.skemagloballab.io/gillAnneSophie.html , Marine Leroi https://www.skemagloballab.io/leroiMarine.html , Martin Paquette https://www.skemagloballab.io/paquetteMartin.html , Antoine Debien https://www.skemagloballab.io/debienAntoine.html (SKEMA Global Lab in AI)https://skemagloballab.io , Thierry Warin https://www.nuance-r.com/principalInvestigator.html (SKEMA Business School (Raleigh, NC))https://www.skemagloballab.io
01-24-2020

Using SKEMA Quantum Studio(Warin 2019), we will teach you how to create your own visuals.

The percentage of people who bought android versus iphone in 2019 worldwide

STEP ONE


# Open the following libraries
library(ggplot2)
library(dplyr)
library(gsheet)
library(kableExtra) #optional

STEP TWO


# Open your data frame
MobileVendor2019 <- read.csv("android_vs_iphone_2019.csv")

# The kable package is an optional step. It makes your table look nicer :)
kable(MobileVendor2019)%>%
scroll_box(width = "100%", height = "400px")
Date Android iOS KaiOS Unknown Samsung Windows Series.40 Nokia.Unknown Tizen Linux SymbianOS BlackBerry.OS Other
2018-12 75.16 21.98 1.13 0.46 0.29 0.33 0.19 0.15 0.11 0.05 0.06 0.05 0.04
2019-01 74.45 22.85 1.10 0.41 0.28 0.30 0.18 0.14 0.10 0.05 0.06 0.05 0.03
2019-02 74.15 23.28 0.96 0.42 0.29 0.29 0.18 0.14 0.09 0.06 0.06 0.05 0.03
2019-03 75.33 22.40 0.84 0.36 0.26 0.28 0.14 0.13 0.07 0.06 0.05 0.04 0.03
2019-04 75.22 22.76 0.73 0.32 0.24 0.26 0.12 0.11 0.07 0.04 0.05 0.05 0.03
2019-05 75.34 22.66 0.77 0.32 0.22 0.24 0.12 0.11 0.08 0.04 0.04 0.04 0.02
2019-06 76.03 22.04 0.79 0.32 0.21 0.21 0.10 0.10 0.07 0.04 0.04 0.03 0.02
2019-07 76.08 22.01 0.81 0.31 0.21 0.20 0.10 0.10 0.07 0.04 0.03 0.03 0.02
2019-08 76.23 22.17 0.59 0.26 0.21 0.20 0.09 0.09 0.07 0.03 0.02 0.03 0.02
2019-09 76.24 22.48 0.38 0.23 0.18 0.17 0.08 0.08 0.06 0.04 0.02 0.02 0.01
2019-10 76.67 22.09 0.42 0.21 0.17 0.15 0.07 0.07 0.05 0.03 0.02 0.02 0.01
2019-11 75.82 22.90 0.49 0.19 0.18 0.15 0.06 0.07 0.05 0.03 0.02 0.02 0.01
2019-12 74.13 24.79 0.35 0.19 0.18 0.13 0.06 0.06 0.04 0.03 0.02 0.02 0.01

STEP THREE


# Data Wrangling 
MobileVendor2019 <- dplyr::select(MobileVendor2019, Date, Android, iOS)

MobileVendor2019 <- tidyr::gather(MobileVendor2019,"brand", "value", 2:3)

MobileVendor2019$Date <- as.numeric(MobileVendor2019$Date)

kable(MobileVendor2019)%>%
scroll_box(width = "100%", height = "400px")
Date brand value
1 Android 75.16
2 Android 74.45
3 Android 74.15
4 Android 75.33
5 Android 75.22
6 Android 75.34
7 Android 76.03
8 Android 76.08
9 Android 76.23
10 Android 76.24
11 Android 76.67
12 Android 75.82
13 Android 74.13
1 iOS 21.98
2 iOS 22.85
3 iOS 23.28
4 iOS 22.40
5 iOS 22.76
6 iOS 22.66
7 iOS 22.04
8 iOS 22.01
9 iOS 22.17
10 iOS 22.48
11 iOS 22.09
12 iOS 22.90
13 iOS 24.79

STEP FOUR


# Create your visual
ggplot(data = MobileVendor2019, aes(x = Date, y = value, color = brand)) + 
  geom_line() +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5)) +
  labs(title = "Android Vs iPhone 2019",
       x = "Date",
       y = "Percentage of people",
       colour = "Brand",
       caption = "Source: SKEMA Quantum Studio")



library(ggplot2)
library(dplyr)
library(gsheet)

browser2019 <- read.csv("browser_2019.csv")

browser2019 <- dplyr::select(browser2019, Date, Chrome, Safari, Firefox)

kable(browser2019)%>%
scroll_box(width = "100%", height = "400px")
Date Chrome Safari Firefox
2018-12 62.28 14.69 4.93
2019-01 61.72 15.23 4.66
2019-02 62.41 15.56 4.39
2019-03 62.58 15.64 4.70
2019-04 62.80 15.83 4.86
2019-05 62.98 15.74 5.01
2019-06 63.69 15.15 4.64
2019-07 63.37 15.05 4.49
2019-08 63.99 15.48 4.44
2019-09 63.72 16.34 4.45
2019-10 64.92 15.97 4.33
2019-11 64.26 16.74 4.47
2019-12 63.62 17.68 4.39

browser2019 <- tidyr::gather(browser2019, "browser", "value", 2:4)

browser2019$Date <- as.numeric(browser2019$Date)

kable(browser2019)%>%
scroll_box(width = "100%", height = "400px")
Date browser value
1 Chrome 62.28
2 Chrome 61.72
3 Chrome 62.41
4 Chrome 62.58
5 Chrome 62.80
6 Chrome 62.98
7 Chrome 63.69
8 Chrome 63.37
9 Chrome 63.99
10 Chrome 63.72
11 Chrome 64.92
12 Chrome 64.26
13 Chrome 63.62
1 Safari 14.69
2 Safari 15.23
3 Safari 15.56
4 Safari 15.64
5 Safari 15.83
6 Safari 15.74
7 Safari 15.15
8 Safari 15.05
9 Safari 15.48
10 Safari 16.34
11 Safari 15.97
12 Safari 16.74
13 Safari 17.68
1 Firefox 4.93
2 Firefox 4.66
3 Firefox 4.39
4 Firefox 4.70
5 Firefox 4.86
6 Firefox 5.01
7 Firefox 4.64
8 Firefox 4.49
9 Firefox 4.44
10 Firefox 4.45
11 Firefox 4.33
12 Firefox 4.47
13 Firefox 4.39

ggplot(data = browser2019, aes(x = Date, y = value, color = browser)) + 
  geom_line() +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5)) +
  labs(title = "Most popular browsers in 2019",
       x = "Date",
       y = "Percentage of people",
       colour = "Browser",
       caption = "Source: SKEMA Quantum Studio")

You have now learned how to create visuals with the help of the SQS(Warin 2019) framework. Congratulations !

The data used in this article was collected from GS stat counter


Follow SKEMA Global Lab in Augmented Intelligence on

Warin, Thierry. 2019. “SKEMA Quantum Studio: A Technological Framework for Data Science in Higher Education.” https://doi.org/10.6084/m9.figshare.8204195.v2.

Citation

For attribution, please cite this work as

Gill, et al. (2020, Jan. 24). Blog: How to create your own visuals. Retrieved from https://blog.skemagloballab.io/posts/2020-01-24-visuals/

BibTeX citation

@misc{gill2020how,
  author = {Gill, Anne Sophie and Leroi, Marine and Paquette, Martin and Debien, Antoine and Warin, Thierry},
  title = {Blog: How to create your own visuals},
  url = {https://blog.skemagloballab.io/posts/2020-01-24-visuals/},
  year = {2020}
}