Announcement

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

  • time series plot with multiline: how to have specific range on each subgraph + y-axis on the same scale for every subgraph?

    Hi everyone,

    I am using -multiline- command, available in SSC. It's the very first time that I used this command, so I need some advice please.
    Basically, each subgraph measures the entire time span, from July 2021 to July 2023.

    However, I want the following, please. And here I am stuck:
    I want each subgraph with a different time span:
    • For first, from top to bottom: the time extends from 01 July 2021 up to 31 July 2021, with the three curves.
    • For second subgraph: the time extends from 1 January to 31 December 2022, with the three curves.
    • For the third one: the time goes from 01 January 2023 to 31 July 2023, with the three curves.
    For first subgraph: ideally I should have a xline breaking data from 01 July 2021 onwards (before 01 July, data are missing),
    For third subgraph: ideally I should have a xline breaking data on 31 July 2023. Data are missing from 01 August onwards.

    How can I have these different time spans into account on my graph, please?

    Also, I need the following please:
    • Every subgraph should be on the same scale on the y-axis.
    Thank you very much.

    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
    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
    end
    format %tc Date

    Code:
    multiline MaxPriceMWh CompetitivePriceMWh RealPrice Date, ///
    xtitle("") xlabel(none) separate by(legend(on)) ms(O D T) ///
    lc(blue red black) plotregion(margin(none))

    Here is the graph produced:
    Click image for larger version

Name:	multiline.png
Views:	1
Size:	64.0 KB
ID:	1732808






    Could anyone help me please?

    Best,
    Michael
    Last edited by Michael Duarte Goncalves; 06 Nov 2023, 02:59.

  • #2
    Sorry, but multiline does not support what you want. Its goals are quite different. You need to draw graphs separately and then combine. Or use by(year) for a year variable.

    Comment


    • #3
      No worries Nick,

      Thank you for taking the time to answer me.
      Lovely day.

      Michael

      Comment

      Working...
      X