- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to add a straight line to a plot in R starting from bottom left and ending at top right?
The abline function can give us a straight line from intercept 0 with slope 1 in an existing plot. We would need to pass the coefficients inside the function as abline(coef = c(0,1)). Therefore, we can use this function to add a line starting from bottom left and ending at top right. This is also called diagonal line because it joins the end points on one side with the opposite of the other side.
Example
> plot(1:10,type="n") > abline(coef=c(0,1))
Output:
Advertisements