CodeInfoNet

Learn programming on the go!

Home » Subsetting and visualizing subsets with matplot

Subsetting and visualizing subsets with matplot

In this article we are going to learn about subsetting and visualizing subsets with matplot.

In Previous article we have learnt about “Matrix operations in R using Basketball data set”. if you have missed it, please go through it once to get familiar with the data set we are using. Here is the link: Matrix operations in R using basketball data set

First of all we will see the use of matplot() function

Matplot() function:

This function is basically used for plotting the columns of matrices. As we already know how to see whole information about any function in R. We will just type “?functionName”.

Ex. “?matplot”

When you execute this for help, you will be amazed that this function expects so many parameters. But guys, don’t be worried. we are not going to use this function often. But it is important that we should be aware of it just to be able to understand other related functions.

So to understand quickly, we will start implementing this function straight away.

In this article, we are going to use FieldGoals Matrix. As this function is used to plot the columns of a matrix, plotting FieldGoals matrices wouldn’t produce a great output. See why in below screenshot:

FieldGoals sample output

The matplot() function will plot only columns and that won’t make any sense and we need data for each player for each year. In short, we need to plot the rows of this matrix.

How to do it? Transpose? Yes!!

Sumit Rajguru

Back to top