CodeInfoNet

Learn programming on the go!

Subsetting and visualizing subsets with matplot

Now, after using all of these parameters in our matplot function, let’s see how our output looks or is there anything else which is also needed to make it look good.

We will execute below line & see the results:

matplot(FieldGoals, type = “b”, pch = 15:18, col=c(1:4,6))

Visualizing Subsets in R

Result looks good but seems like we are missing something here. What’s that? Legend? Probably, Yes!!

Because we are not able to understand which line shows graph of which player. Including legend to a graph is always a good practice.

We can include legend to this graph. Isn’t it amazing? Coding the legend is also a fun part. Let’s do that too.

For this, we can make a use of Legend() function. You can always check for its parameters.

Sumit Rajguru

Back to top