# Time Series Plotting using plot\_ty

**URL:** <https://community.plotly.com/t/time-series-plotting-using-plot-ty/1230>\
**Category:** Plotly R\
**Created:** [June 7, 2016, 11:10pm UTC](https://community.plotly.com/t/time-series-plotting-using-plot-ty/1230 "2016-06-07T23:10:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![acjones](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@acjones](https://community.plotly.com/u/acjones)\
**Post date:** [June 7, 2016, 11:10pm UTC](https://community.plotly.com/t/time-series-plotting-using-plot-ty/1230/1 "2016-06-07T23:10:22Z")

</div>

I have some time series data that has gaps and I don’t want to connect the gaps. I know there is the connectgaps attribute in Python but want to know if there is something like that for R. Thanks!

---

<div class="post-metadata">

**Author:** ![yankev](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/yankev/32/410_2.png) [@yankev](https://community.plotly.com/u/yankev)\
**Post date:** [June 14, 2016, 5:28pm UTC](https://community.plotly.com/t/time-series-plotting-using-plot-ty/1230/2 "2016-06-14T17:28:10Z")

</div>

Hi, is this the attribute you were looking for: [https://plot.ly/r/reference/#scatter-connectgaps](https://plot.ly/r/reference/#scatter-connectgaps)?

---

<div class="post-metadata">

**Author:** ![timelyportfolio](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@timelyportfolio](https://community.plotly.com/u/timelyportfolio)\
**Post date:** [June 14, 2016, 8:04pm UTC](https://community.plotly.com/t/time-series-plotting-using-plot-ty/1230/3 "2016-06-14T20:04:00Z")

</div>

Perhaps, some code would help.

```auto
library(xts)
library(plotly)

x <- xts(
  c(runif(10,0,1), NA, NA, runif(10,0,1)),
  order.by = seq.Date(Sys.Date(), by="days", length.out=22)
)

plot(x)

plot_ly(
  data = data.frame(date=index(x), value=x[,1,drop=T]),
  x = date,
  y = value
)

plot_ly(
  data = data.frame(date=index(x), value=x[,1,drop=T]),
  x = date,
  y = value,
  connectgaps = TRUE
)

```

![](https://us1.discourse-cdn.com/flex024/uploads/plot/original/1X/ce7c91b22a1ffa1aa492551bdf844c7ddf250ff6.png)
