# Is there a way to make an annotation for time series axis in Gadfly?

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-make-an-annotation-for-time-series-axis-in-gadfly/12478>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 19, 2018, 1:21am UTC](https://discourse.julialang.org/t/is-there-a-way-to-make-an-annotation-for-time-series-axis-in-gadfly/12478 "2018-07-19T01:21:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![YongHee-Kim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yonghee-kim/32/5965_2.png) [@YongHee-Kim](https://discourse.julialang.org/u/YongHee-Kim)\
**Post date:** [July 19, 2018, 1:21am UTC](https://discourse.julialang.org/t/is-there-a-way-to-make-an-annotation-for-time-series-axis-in-gadfly/12478/1 "2018-07-19T01:21:54Z")

</div>

I’m trying to draw a line on X-axis with time series dataset

Here is a minimal working example

```julia
using Gadfly, Compose
y = broadcast(i -> i^2, 1:30)

line_anno = compose(context(), stroke("red"), Shape.line([(10, 0), (10, 1000)]))

# works fine
plot(x = 1:30, y = y, Geom.line, Guide.annotation(line_anno))

# do not work
x = broadcast(i -> DateTime(2000, 1, i), 1:30)
plot(x = x, y = y, Geom.line, Guide.annotation(line_anno))

# do not work either
d = Date(2000, 1, 10)
date_anno = compose(context(), stroke("red"), Shape.line([(d, 0), (d, 1000)]))

```

thank you 🙂

---

<div class="post-metadata">

**Author:** ![k945](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/k945/32/8906_2.png) [@k945](https://discourse.julialang.org/u/k945)\
**Post date:** [July 19, 2018, 5:03am UTC](https://discourse.julialang.org/t/is-there-a-way-to-make-an-annotation-for-time-series-axis-in-gadfly/12478/2 "2018-07-19T05:03:10Z")

</div>

From the [gadfly documentation](http://gadflyjl.org/stable/lib/geoms/geom_vline.html#Aesthetics-1) you could try

```julia
x = map(i -> Date(2000, 1, i), 1:30)
plot(x = x, y = y, Geom.line, Guide.xticks(orientation=:vertical),
    xintercept=[x[6], x[20]], Geom.line, Geom.vline(style=[:solid]))

```

Hope this helps

---

<div class="post-metadata">

**Author:** ![YongHee-Kim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yonghee-kim/32/5965_2.png) [@YongHee-Kim](https://discourse.julialang.org/u/YongHee-Kim)\
**Post date:** [July 19, 2018, 5:30am UTC](https://discourse.julialang.org/t/is-there-a-way-to-make-an-annotation-for-time-series-axis-in-gadfly/12478/3 "2018-07-19T05:30:18Z")

</div>

Thank you  
that was What I wanted, I dind’t lookup doc hard enough…

I found out this works too.

```julia
date_anno = compose(context(), stroke("red"), Shape.line([(100px, 0px), (100px, 1000px)]))
plot(x = x, y = y, Geom.line, Guide.annotation(date_anno))

```
