- 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 create a vertical line in a time series plot in base R?n

To create a time series plot, we can use simply apply plot function on time series object and if we want to create a vertical line on that plot then abline function will be used with v argument.

For example, if we have a time series object called T and we want to create a time series plot of T with vertical line at point 5 then we can use the below given command after creating the plot −

abline(v=5)

## Example

To create a vertical line in a time series plot in base R, use the following code −

x<-ts(rpois(10,5)) x Time Series: Start = 1 End = 10 Frequency = 1

If you execute the above given code, it generates the following output −

[1] 3 8 5 8 6 4 3 2 5 7

To create a vertical line in a time series plot in base R, add the following code to the above code −

x<-ts(rpois(10,5)) plot(x)

## Output

If you execute all the above given codes as a single program, it generates the following output −

To create a vertical line in a time series plot in base R, add the following code to the above code −

x<-ts(rpois(10,5)) plot(x) abline(v=6)

## Output

If you execute all the above given codes as a single program, it generates the following output −

- Related Articles
- How do you plot a vertical line on a time series plot in Pandas?
- How to create vertical line for X variable at median in base R plot
- How to create a time series plot in R without time vector?
- How to create a plot with dashed regression line in base R?
- Python - Create a Time Series Plot using Line Plot with Seaborn
- Python - Create a Time Series Plot with multiple columns using Line Plot
- How to create a perpendicular arrow in base R plot?
- How to create a cumulative sum plot in base R?
- How to create a plot in base R without margins?
- How to create a line chart using ggplot2 with a vertical line in R?
- How to create a dotted vertical line using ggplot2 in R?
- How to create vertical line in xyplot in R?
- How to create a horizontal line in a histogram in base R?
- How to create dotted vertical lines in a plot using ggplot2 in R?
- How to create horizontal line for Y variable at median in base R plot?