![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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 create a line that passes through specified points in an R plot?
To create a line that passes through specified points, we first need to create the plot then using plot function then xspline function can be used to join the points with straight lines. The xspline function is specifically designed to draw curves and hence it can be also used to join points in a plot as shown in the below examples.
Example1
> plot(rpois(10,5)) > xspline(c(4,3,1),c(7,5,2))
Output:
Example2
> plot(rnorm(10)) > xspline(c(4,3,1),c(0.3,-0.5,-1.5))
Output:
Advertisements