Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • time series graph : Advices needed please

    Hi everyone,

    I have to do a graphic time series for one of our studies. It's the first time I've worked with time series, so I'm totally inexperienced with this type of data and graphics.

    I need your help. I'd like to make a graph that's easy to read and pleasing, not like the one below. Could you please help me?
    Also, the scale on the x-axis is far too large and too detailed. My data runs from 1 July 2021 to 31 July 2023, but the scale extends to January 2024.
    I've also noticed that the hours/minutes/seconds are not correct. I should have rounded times, like 00:00:00, 01:00:00 and so on.

    Unfortunately, we have to work with hourly daily data. So it is a little bit noisy.

    I've also been asked to build 3 other subfigures, one under the other, in this way:

    (1) The first must contain only data from July 2021 to December 2021.
    (2) The second must contain the whole of 2022.
    (3) The third must contain the year 2023, up to 31 July 2023.

    These three subfigures must meet two conditions: they must contain the same variables as those in the graph enclosed and they must be on the same scale on the y-axis, for a better comparison.

    Problem: The data are not given before July 2021 and after July 2023.
    Could you please provide me with the tools to do this?


    Here is a dataex:


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double(Date MaxPriceMWh CompetitivePriceMWh real_prices)
    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
    1.9407888e+12 111.079 110.579  95.54
    1.9407924e+12 111.079 110.579  96.18
     1.940796e+12 110.579 110.479  91.99
    1.9407996e+12 110.579 110.479    100
    1.9408032e+12 111.106 110.706  99.72
    1.9408068e+12 110.706 110.446  99.56
    1.9408104e+12 110.706 110.446  99.67
     1.940814e+12 110.706 110.446  99.72
    1.9408176e+12 110.886 110.706 100.12
    1.9408212e+12 111.206 111.106    102
    end
    format %tc Date
    And the code used:

    Code:
    tsset Date
    twoway (line MaxPriceMWh Date, lc(blue%50)) ///
           (line CompetitivePriceMWh Date, lc(red%40)) ///
           (line real_prices Date, lc(black%30)) , ///
           legend(label(1 "Strategic Price") label(2 "Competitive Price") label(3 "Real Prices")) ///
           title("Electricity Prices") ///
           subtitle("From July 2021 to July 2023") ///
           xtitle("Date") ytitle("MW/h") ///
           plotregion(margin(none))
    Many thanks in advance, as it's already taking me some time...

    Have a nice day.

    Michael
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	128.9 KB
ID:	1732531

    Last edited by Michael Duarte Goncalves; 03 Nov 2023, 04:24.

  • #2
    When I meant a subfigure, I meant something in this vein, but with a y-axis identical for all three subgraphs, and taking into account that dates are not the same between the three subgraphs, as mentionned in #1.
    Also, each subgraph should have its own colours.

    Thank you in advance.

    Michael

    P.S.: These graphs were made using the -program multtsline- proposed by Nick Cox in a previous post.
    https://www.statalist.org/forums/for...es#post1355560

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	168.3 KB
ID:	1732557

    Last edited by Michael Duarte Goncalves; 03 Nov 2023, 08:19.

    Comment

    Working...
    X