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

09 Advanced Graphs

Uploaded by

anshulja2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

09 Advanced Graphs

Uploaded by

anshulja2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DATA INSIGHTS & VISUALIZATION

Session 9

Exercises

Pablo Monfort Instituto de Empresa


Session's description
We will use this session for 2 purposes:
- study other advanced visualizations in R.
- build interactive graphs in R

Let me describe the new tasks:


Task 1. Research in Google about these types of visualizations:
- wordclouds
- Chord diagrams,
- Sankey diagrams,
- others
Explain and describe in 4 brief paragraphs different real situations
where every of these 4 graphs could be used and useful.

Task 2. Download your assigned dataset for the Data Viz competition and
create 2 interactive graphs for the dataset using the new commands
in R explained below.

Task 3. Create one of the graphs you found in task 1 with your Viz
competitions dataset 2
2
Session's theory: the plotly library

# Script to build interactive graphs using R (libraries plotly and htmltools)


# Execute line by line this script and adapt it to solve the task 2.
# Remember! If some of the libraries are not installed, you will obtain error. Install it in that case!

# 1. We create the normal ggplot graphs


library(ggplot2)
a = ggplot(diamonds,aes(x=price)) + geom_histogram()
a
b = ggplot(diamonds,aes(x=cut)) + geom_bar()
b

# 2. We transform them into an interactive version


library(plotly)
a2= plotly::ggplotly(a)
b2= plotly::ggplotly(b)

# 3. We save them in an html document


# (you can save in the html document 1, 2 or as many graphs as you want!)
library("htmltools")
htmltools::save_html(list(a2,b2), "My graph.html")

# Check now your working directory. This html file has been created there!
3
3
Deadlines

Task 1: Group task.


One submission per group.
Send the PDF document using the link in Blackboard

Task 2: Single task.


One submission per person.
Send the R script and the created graph.
Use the other link in Blackboard

Task 3: Optional.
One submission per group.
Send the PDF document using the link in Blackboard for task 1

Deadline:
May 10th, 11:59PM

4
4

You might also like