To be solved at home before the exercise session.
Visit the website https://datavizproject.com/ and pick one data visualization/plot that interests you. Find out how it is drawn and what aspects of the data the different components represent. Be prepared to explain how your visualization of choice works in the class.
data()
in R to show all data sets currently available in your installed packages. Go through the data sets and pick one that interests you. Check the help file of the data set using the command ?packagename
for more detailed information. Be prepared to describe your answers to the following questions in the class:
To be solved at the exercise session.
Note: all the needed data sets are available in base R.
rivers
contains the lengths of 141 major rivers in North America.
cut
may prove helpful.islands
contains the areas of all landmasses in the world which exceed a certain threshold.
Nile
contains yearly measurements of the flow of the river Nile.
rgl
. The following code plots an interactive 3d-scatter plot of the first three variables in the iris
data. Find out how you can colour the points in the plot according to the variable Species
.install.packages("rgl")
library(rgl)
# Opens in a new window
open3d()
plot3d(iris[, 1:3])
ggplot2
by running the following code.install.packages("ggplot2")
library(ggplot2)
ggplot(data = mpg, aes(x = hwy, y = cty)) +
geom_point() +
labs(x = "Highway miles per gallon", y = "City miles per gallon")
What does the plot represent? Experiment with the code and find out how you can color the points according to the class
of the car.
Numerous tutorials about ggplot2
can be found online. Check out at least https://r4ds.had.co.nz/data-visualisation.html and http://r-statistics.co/ggplot2-Tutorial-With-R.html.