Visualisation

Jake

15/05/2021

Packages often used are MASS and ggplot2, and in 3142 we also use ISLR

## Warning: package 'ISLR' was built under R version 3.6.3

Base R plot examples

Bar plot Example:

Line Graph Example:

Scatter plot Example:

Boxplot Example:

Further Line Graph Example:

Curve Function Example:

Advanced curve example:

Graphical windows example

You can add lines to a plot manually with the abline function. It can be in the form \(y=a+bx\) or in terms of horizontal and vertical location:

Can add lines through the use of segments which join set coordinates together:

Contour Plots can be used to create more sophisticated plots. They can be used to represent three dimensional data, like a topographical map. The contour() function takes a x vector, a y vector and a matrix whose elements respond to the z value for each pair of x,y coordinations

The pairs() function can be used to create a scatterplot matrix. This can also be done for just a subset of variables