Hello everyone,
I have timeseries and i want to have on xtics Datetime format.
my data is called array
:
1980 1 111.439 1980-01-01 1
1980 2 111.255 1980-02-01 2
1980 3 111.159 1980-03-01 3
⋮
2019 10 109.153 2019-10-01 478
2019 11 108.969 2019-11-01 479
2019 12 108.689 2019-12-01 480
when i code this
@gp 1:480 array[:,3] " w lp pt 7 lc 'black' notit "
@gp :- "set xtics ('1980' 1, '1985' $(5*12), '1990' $(10*12),'1995' $(15*12),'2000' $(20*12),'2005' $(25*12),'2010' $(30*12),'2015' $(35*12)) font ',25'"
i get this:
However i want an easier way to define my xticlabels, so i code this :
@gp "set xdata time" "set timefmt '%Y-%m-%d' " "set format x '%Y'" "set xrange ['1980-01-01' : '2019-12-01']"
@gp :- "plot 'array.txt' u 4:3 w lp pt 7 lc 'black' notit "
@gp :- "set xtics '1980-01-01', 4*12*2629746, '2019-12-01' font ',25'"
that give me this:
this (second) way is better to define easier my xticlabels, BUT i have to write my array firstly and then ploting it. "set xtics '1980-01-01', 4*12*2629746, '2019-12-01' font ',25'"
means that the xticlabels displayed per 4 years (4*12).
I am wondering if i can avoid the writing of the array with this way:
@gp "set xdata time" "set timefmt '%Y-%m-%d' " "set format x '%Y'" "set xrange ['1980-01-01' : '2019-12-01']"
@gp :- string.(Array[:,4]) Float64.(Array[:,3]) " w lp pt 7 lc 'black' notit "
however i get this error:
┌ Error:
│
│ gnuplot> plot $data1 w lp pt 7 lc 'black' notit
│ ^
│ line 13020: Need full using spec for x time data
└ @ Gnuplot C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:908
ERROR: Gnuplot error: ["Need full using spec for x time data"]
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] gpexec(gp::Gnuplot.GPSession, command::String)
@ Gnuplot C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:911
[3] execall(gp::Gnuplot.GPSession; term::String, output::String)
@ Gnuplot C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:940
[4] execall
@ C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:921 [inlined]
[5] driver(::Symbol, ::Vararg{Any, N} where N; is3d::Bool)
@ Gnuplot C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:1336
[6] driver(::Symbol, ::Vararg{Any, N} where N)
@ Gnuplot C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:1262
[7] top-level scope
@ REPL[195]:1
I do not understand Need full using spec for x time data
can you help me please ???
when i code
@gp "set xdata time" "set timefmt '%Y-%m-%d' " "set format x '%Y'" "set xrange ['1980-01-01' : '2019-12-01']"
@gp :- string.(Array[:,4]) Float64.(Array[:,3]) "u 1:2 w lp pt 7 lc 'black' notit "
i get this :
┌ Error:
│ line 20716: warning: Skipping data file with no valid points
│
│ gnuplot> plot $data1 u 1:2 w lp pt 7 lc 'black' notit
│ ^
│ line 20716: all points y value undefined!
└ @ Gnuplot C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:908
ERROR: Gnuplot error: ["all points y value undefined!"]
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] gpexec(gp::Gnuplot.GPSession, command::String)
@ Gnuplot C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:911
[3] execall(gp::Gnuplot.GPSession; term::String, output::String)
@ Gnuplot C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:940
[4] execall
@ C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:921 [inlined]
[5] driver(::Symbol, ::Vararg{Any, N} where N; is3d::Bool)
@ Gnuplot C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:1336
[6] driver(::Symbol, ::Vararg{Any, N} where N)
@ Gnuplot C:\Users\ms\.julia\packages\Gnuplot\jJ4hs\src\Gnuplot.jl:1262
[7] top-level scope
@ REPL[242]:1