Announcement

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

  • Easy question re x axis on graphs not aligning

    Hey All,

    I am self taught Stata, so the learning curve is/was steep and it has been a ride. So any help I much appreciate.

    I am researching some historical prices (highest, lowest and closing prices for half hour periods for January) and am comparing two years prices in January. The y axis is price and x is time. Please look at the attached graph. Each of the data runs for 31 days (throughout January) and you can see the red line starts later and finishes earlier than the green/blue line. These need to start on the same day as it is skewing the result.

    The code is below;
    twoway (rarea annualhigh15d annuallow15d newdatetime if tin(01jan2019 00:00:00, 31jan2019 23:59:59), fcolor(ltblue%75) lwidth(vthin) yaxis(2) xaxis(2)) (line close newdatetime if tin(01jan2020 00:00:00, 31jan2020 23:59:59), yaxis(1) xaxis(1) fcolor(ltblue%75) lwidth(vthin)) (line annualclose15d newdatetime if tin(01jan2019 00:00:00, 31jan2019 23:59:59), yaxis(2) xaxis(2)), title(Platinum: January Seasonality of 15 Years of Data + Current Year) name(PL1_Jan_Season_15yr_current,replace) xtitle("") scheme(s2color) legend(on) xsize(20) ysize(12) scale(.4) xlabel(#31, format(%tcdd) grid) xmtick(##1) ylabel(#10)

    This is happening on every graph for each month, but I feel like there is a command after the input variable to force Stata to align the x axis' but I cannot work out what it is.

    Again any help would be tremendously helpful.
    Attached Files
Working...
X