Labelling of points on a scatterplot helps us to identify the pair of observations. For example, if we are plotting weight and height of people then we can label it with person’s name, therefore, we will be able to understand which pair of points belong to which person. This can be done by using text function after creating the scatterplot with plot function.
x <-c(2,4,5,8,10) y <-c(15,25,27,29,30) plot(x,y)
Now suppose we have labels and want to add them on the above plot then it can be done as follows −
Labels <-c("One","Two","Three","Four","Five") text(x,y,labels=Labels,cex=0.4,pos=3)