
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Put Labels on a Scatterplot Using plot() Function in R
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.
Example
x <-c(2,4,5,8,10) y <-c(15,25,27,29,30) plot(x,y)
Output
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)
Output
Advertisements