# How to create a time series plot in R without time vector?

R ProgrammingServer Side ProgrammingProgramming

#### Artificial Intelligence : The Future Of Programming

15 Lectures 54 mins

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### C Programming from scratch- Master C Programming

Best Seller

60 Lectures 8 hours

To create a time series plot in R without time vector, we can use ts.plot function.

For Example, if we have a vector called X then we can create the time series plot of X by using the command ts.plot(X), the Output of this command will have a time axis in place of X-axis. Check out the below Examples to understand how it works.

## Example 1

Consider the following vector −

x<-rnorm(10)
ts.plot(x)

## Output

If you execute the above given snippet, it generates the following Output −

## Example 2

To create a time series plot in R without time vector, add the following code to the above snippet −

y<-rpois(10,5)
ts.plot(y)


## Output

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

Updated on 28-Oct-2021 10:03:49