Time Series with Quarterly data not plotting correctly

36 Views Asked by At

I've got the following TS: (available here. used dput to export as per @sconfluentus suggestion)

ts3       Qtr1      Qtr2      Qtr3      Qtr4
1996                      99.53661 100.00000
1997  99.97004  99.81439  99.83626  99.89607
1998  99.63327  99.67089  99.08486  95.40506
1999  92.33478  90.40498  89.15398  88.45411
2000  88.07940  87.90297  87.83893  87.88825
2001  88.00351  88.16990  88.27630  88.38974
2002  88.53825  88.66707  88.78324  88.85596
2003  88.90146  88.86197  88.75703  88.69979
2004  88.60257  88.44168  88.21923  87.90716
2005  87.51697  87.12123  86.31867  85.77275
2006  84.69936  83.70466  82.70524  82.07538
2007  81.09732  80.31627  80.40409  80.90472
2008  81.25585  81.74333  82.57073  84.78822
2009  85.62749  85.84770  80.41626  80.37309
2010  80.19556  79.87521  77.60659  77.71701
2011  77.53630  77.38652  77.62422  76.96972
2012  76.85396  77.25449  77.66925  77.19131
2013  77.33289  76.16315  76.15370  75.66456
2014  75.79406  73.45276  74.28542  74.18886
2015  74.20661  73.91630  73.80376  74.02166
2016  74.06891  73.37797  73.99337  73.97490
2017  74.03728  74.15334  73.76682  73.75985
2018  73.68989  73.96065  74.33401  73.67997
2019  72.97971  73.04950  73.11735  73.17182
2020  72.35422  69.24294  66.48046  66.81105
2021  65.68547  57.57196  55.00889  56.00235
2022  55.61863  55.86456  55.32120  56.84359
2023  56.59352                           

And I'm trying to plot it using base::plot, like plot(ts3, ylab = "TCI", xlab = "Quarters"). But the x-axis only does not shows ticks for quarters, as well only labels and show ticks for the years 2000 through 2020, as shown below:

enter image description here

I've tried to use this:

plot(ts3, ylab = "TCI", xaxt = "n")
axis(1, at=seq(1, length(ts3), 1), labels = seq.Date(as.Date("1996-07-01"), as.Date("2023-01-01"), by = "quarter"))

But nothing happened, as the following plot shows: enter image description here

Is there a way to label a time series graph with the adequate quartely ticks labels?

0

There are 0 best solutions below