Hi everyone,
I am struggling with date values in my time-series plot.
In fact, my date variable goes from July 2021 up to July 2023.
However, in my graph, the range extends from 22jun2021 16:53:09 up to 24jun2024 15:06:40.
Could anyone help me to have only as a range my initial period up to the end period please?
Also the "clock" part of my variable "Date" is not correct (it should always be rounded to hh:00:00). My true Date variable is correct.
Here is a dataex:
And here is my graph: 
The code used:
Edit: I tried this, but it's not working:
[CODE]
# delimit ;
tsline MaxPriceMWh, lcolor(blue%60) ||
tsline CompetitivePriceMWh, lcolor(red%30) ||
tsline RealPrice, lcolor(black%40) ||,
legend(label(1 "Strategic Prices") label(2 "Competitive Prices") label(3 "Real Prices"))
title("Hourly Electricity Prices")
subtitle("From July 2021 to July 2023", size(vsmall))
xtitle("Date") ytitle("MW/h")
tscale(range(tc(01jul2021 00:00:00(1)31jul2023 23:00:00)))
plotregion(margin(none))
note("{it:Note:} From May 1{sup:st}, 2023, values are those of 2022 for real prices.", size(small))
scheme(white_w3d)
;
# delimit cr
range() invalid -- invalid numlist
r(121);
[CODE]
All the best,
Michael
I am struggling with date values in my time-series plot.
In fact, my date variable goes from July 2021 up to July 2023.
However, in my graph, the range extends from 22jun2021 16:53:09 up to 24jun2024 15:06:40.
Could anyone help me to have only as a range my initial period up to the end period please?
Also the "clock" part of my variable "Date" is not correct (it should always be rounded to hh:00:00). My true Date variable is correct.
Here is a dataex:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double(Date MaxPriceMWh CompetitivePriceMWh RealPrice) 1.9407168e+12 110.079 109.819 91.99 1.9407204e+12 110.079 109.819 91.26 1.940724e+12 110.079 109.819 91.65 1.9407276e+12 110.079 109.819 91.99 1.9407312e+12 110.079 109.819 91.99 1.9407348e+12 110.579 110.479 92.34 1.9407384e+12 110.579 110.579 95.95 1.940742e+12 110.579 110.579 98.19 1.9407456e+12 110.579 110.259 96.4 1.9407492e+12 110.079 110.039 94.93 1.9407528e+12 110.079 109.819 93.25 1.9407564e+12 110.079 109.819 93 1.94076e+12 110.079 109.819 90.19 1.9407636e+12 110.079 109.819 85.67 1.9407672e+12 110.079 109.819 85 1.9407708e+12 110.079 109.819 84.04 1.9407744e+12 110.079 109.819 89.14 1.940778e+12 110.079 109.819 93 1.9407816e+12 110.079 109.819 95.24 1.9407852e+12 110.579 110.579 95.93 end format %tc Date
The code used:
Code:
tsset Date # delimit ; tsline MaxPriceMWh, lcolor(blue%60) || tsline CompetitivePriceMWh, lcolor(red%30) || tsline RealPrice, lcolor(black%40) ||, legend(label(1 "Strategic Prices") label(2 "Competitive Prices") label(3 "Real Prices")) title("Hourly Electricity Prices") subtitle("From July 2021 to July 2023", size(vsmall)) xtitle("Date") ytitle("MW/h") plotregion(margin(none)) note("{it:Note:} From May 1{sup:st}, 2023, values are those of 2022 for real prices.", size(small)) scheme(white_w3d) ; # delimit cr
- Is it possible to only have the year and month in my x-axis please?
Edit: I tried this, but it's not working:
[CODE]
# delimit ;
tsline MaxPriceMWh, lcolor(blue%60) ||
tsline CompetitivePriceMWh, lcolor(red%30) ||
tsline RealPrice, lcolor(black%40) ||,
legend(label(1 "Strategic Prices") label(2 "Competitive Prices") label(3 "Real Prices"))
title("Hourly Electricity Prices")
subtitle("From July 2021 to July 2023", size(vsmall))
xtitle("Date") ytitle("MW/h")
tscale(range(tc(01jul2021 00:00:00(1)31jul2023 23:00:00)))
plotregion(margin(none))
note("{it:Note:} From May 1{sup:st}, 2023, values are those of 2022 for real prices.", size(small))
scheme(white_w3d)
;
# delimit cr
range() invalid -- invalid numlist
r(121);
[CODE]
All the best,
Michael