# BUG Plots; pgfplotsx using twinx() ofsets the dates

**URL:** <https://discourse.julialang.org/t/bug-plots-pgfplotsx-using-twinx-ofsets-the-dates/47580>\
**Category:** Visualization\
**Tags:** plotting, pgfplotsx\
**Created:** [October 1, 2020, 8:32am UTC](https://discourse.julialang.org/t/bug-plots-pgfplotsx-using-twinx-ofsets-the-dates/47580 "2020-10-01T08:32:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JosephPollacco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josephpollacco/32/51404_2.png) [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)\
**Post date:** [October 1, 2020, 8:32am UTC](https://discourse.julialang.org/t/bug-plots-pgfplotsx-using-twinx-ofsets-the-dates/47580/1 "2020-10-01T08:32:02Z")

</div>

Hi,

I am using Plots;pgfplotsx() and the twinx() functionality and I want to report a bug that the dates are offset the dates as it can be seen in the figure.

It will be great if this bug can be fixt.

```julia
					DateTick=clim.Date[1]:Day(30):clim.Date[clim.N_Climate]
					
					DateTick2= Dates.format.(DateTick, "d u Y")
					
					Plot1=Plots.plot(layout=1)
					
					Plots.bar!(Plot1, clim.Date[1:clim.N_Climate], clim.Pr[1:clim.N_Climate], color =:blue, colorbar=false, label= L"$ Pr \ [mm \ day^{-1}] $", legend=:topleft)
					
					Plots.bar!(Plot1, clim.Date[1:clim.N_Climate], clim.Pr_Through[1:clim.N_Climate], color =:cyan, colorbar=false, label= L"$ Pr_{through} \ [mm \ day^{-1}] $", ylabel=L"$ Precipitation \ Throughfall[mm] $")

					Plots.plot!(**twinx()**, clim.Date[1:clim.N_Climate], clim.Pet[1:clim.N_Climate], color =:green, colorbar=false, label= L"$ Pet_{int} $", ylabel=L"$Pet_{int} \ [mm \ day^{-1}] $", legend=:topright)
					
					Plots.plot!(Plot1, grid=false, size=(1000, 600), xrotation=rad2deg(pi/3), xticks=(DateTick, DateTick2), framestyle = :origin)
					
					
					Path = path.Plot_RainfallInterception * "_" * string(iSim) * ".svg"
					Plots.savefig(Plot1, Path)
		

```

 ![WAITOA_Plot_RainfallInterception_100](https://global.discourse-cdn.com/julialang/original/3X/4/a/4a09f1b3aebfdbfc8db4ba7658f2db7e19d566e2.png)

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [October 1, 2020, 9:40am UTC](https://discourse.julialang.org/t/bug-plots-pgfplotsx-using-twinx-ofsets-the-dates/47580/2 "2020-10-01T09:40:02Z")

</div>

This issue is already tracked: [https://github.com/JuliaPlots/Plots.jl/issues/2071](https://github.com/JuliaPlots/Plots.jl/issues/2071)

---

<div class="post-metadata">

**Author:** ![JosephPollacco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josephpollacco/32/51404_2.png) [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)\
**Post date:** [October 1, 2020, 8:32pm UTC](https://discourse.julialang.org/t/bug-plots-pgfplotsx-using-twinx-ofsets-the-dates/47580/3 "2020-10-01T20:32:57Z")

</div>

Thanks, therefore the problem will be solved shortly.
