We are going to investigate a brief form of the IMDB (movies) data set. Movies were selected for inclusion if they had a known length, had been rated by at least one IMDB user and had an mpaa rating. This gives $4847$ films, where each film has $24$ associated variables. The data can be called and viewed using:
data(bmov, package = "BristolVis") head(bmov)
Let's start with some simple scatter plots using the bmov
data:
plot(bmov$Length, bmov$Rating)
xlab
and ylab
arguments to specify suitable axis labels.plot(bmov$Length, bmov$Rating, xlab="Length", ylab="Rating")
ylim
argument to specify a y-axis range from 1 to 10.plot(bmov$Length, bmov$Rating, xlab="Length", ylab="Rating", ylim = c(1,10))
col
argument to change the colour of the points.plot(bmov$Length, bmov$Rating, xlab="Length", ylab="Rating", ylim = c(1,10), col = 2)
main
argument to give the plot a suitable title.plot(bmov$Length, bmov$Rating, xlab="Length", ylab="Rating", ylim = c(1,10), col = 2, main = "Movie rating against length")
op = par(mar=c(3,3,2,1), tck=-.01, las=1, cex.axis=0.4)
and generated our plot in (5) again, what will happen? can you figure out what mar, tck, las and cex.axis do?
par(op)
and generate the last plot again. Do you see the reset effect?
We will now investigate the distribution of movie years using histograms.
hist
function to plot a histogram of the movie years.hist(bmov$Year)
15
.hist(bmov$Year, breaks = 15)
xlab
and ylab
arguments to specify suitable axis labels.hist(bmov$Year, breaks = 15, xlab = "Year", ylab = "Counts")
col
argument to change the colour of the histogram.hist(bmov$Year, breaks = 15, xlab = "Year", ylab = "Counts", col = 3)
main
argument to give the plot a suitable title.hist(bmov$Year, breaks = 15, xlab = "Year", ylab = "Counts", col = 3, main = "Histogram for years of the movies")
boxplot(bmov$Rating)
boxplot(bmov$Rating ~ bmov$Romance)
Romance
and Action
.boxplot(bmov$Rating ~ bmov$Romance + bmov$Action)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.