# Xticks in month format

**URL:** <https://discourse.julialang.org/t/xticks-in-month-format/57721>\
**Category:** Performance\
**Created:** [March 22, 2021, 2:54pm UTC](https://discourse.julialang.org/t/xticks-in-month-format/57721 "2021-03-22T14:54:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dires](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@dires](https://discourse.julialang.org/u/dires)\
**Post date:** [March 22, 2021, 2:54pm UTC](https://discourse.julialang.org/t/xticks-in-month-format/57721/1 "2021-03-22T14:54:24Z")

</div>

Hi  
I am working on a yearly planning model in hourly resolution, and I want to plot the result with the X-axis in months, not in hours. how can I do my plots in Gadfly?

---

<div class="post-metadata">

**Author:** ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)\
**Post date:** [March 22, 2021, 3:41pm UTC](https://discourse.julialang.org/t/xticks-in-month-format/57721/2 "2021-03-22T15:41:40Z")

</div>

You could try something like:

```julia
using Dates

plot(..., Guide.xticks(ticks=DateTime("2021-01-1"):Month(1):DateTime("2021-12-31"))

```

It may be easier to help if you show a small example of your time variable.

---

<div class="post-metadata">

**Author:** ![dires](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@dires](https://discourse.julialang.org/u/dires)\
**Post date:** [March 22, 2021, 3:51pm UTC](https://discourse.julialang.org/t/xticks-in-month-format/57721/3 "2021-03-22T15:51:39Z")

</div>

tim=length(TD)  
df1=DataFrame(TD)

Plot1=Gadfly.plot(df1, x=1:tim, y=:x1, Geom.line,  
Guide.xticks(ticks=DateTime(“2021-01-1”):Month(1):DateTime(“2021-12-31”)),Theme(default\_color=“green”),  
Guide.xlabel(“Months”), Guide.ylabel(“Power(MW)”),  
Guide.Title(“Total Demand”))  
 ![TD](https://global.discourse-cdn.com/julialang/original/3X/5/d/5d76c73e8a1326898b4acafc785f1d771bd83a0d.jpeg)

I have tried it but I got the error message below.  
MethodError: no method matching isless(::DateTime, ::Int64)  
Closest candidates are:  
isless(!Matched::Missing, ::Any) at missing.jl:87  
isless(!Matched::PyCall.PyObject, ::Any)
