# How to plot n-dimensional TimeSeries data object?

I have a spectrometer which is generating time-series data every 100ms. I'd like to analyze/plot this data in Mathematica, but I'm not certain the best way to do it.

It's in this form:

| 300 | 301 | ... | 700|
0  | y0  | y1  | ... | yn |
100| ... | ... | ... | ...|

I can import the data and extract it just fine

data = Import["testingdata.txt","TSV"];
wavelength = data[[30,3;;]];
unixtime = data[[31;;,2]];
absorbance = data[[31;;,3;;]];

Where the file headers take up rows 1;;29.

Naively using ListPlot to plot absorbance does provide a time series result, but I was wondering if there's a way to create a TimeSeries object to store this multidimensional data (TimeSeries Documentation). Looking at the Docs, it looks like I would have to create a TimeSeries object for each wavelength in my spectrum, which is not ideal. Is there a better way to do this? I see that the TemporalData function is a more generalized version of TimeSeries but it doesn't seem to have support for {t_i,v_i1,v_i2...} data.

Edit 1: Per @Domen's comment, TimeSeries does support arrays:

ts = TimeSeries[Transpose[{unixtime,absorbance}]]

Edit 2: I created a 3D plot showing essentially how I'd like to visualize the data, but I want to condense it down to 2D.

• How exactly do you want to analyze data? Your objective(s) will determine what is the best way to store and represent your data. As stated in the documentation, The values vi can be scalars or arrays of any dimension, but must all be of equal dimensionality. Therefore, you can store all the absorbance values in one TimeSeries object. ts = TimeSeries[Transpose[{unixtime, absorbance}]] Commented Oct 25, 2022 at 17:03
• For the analysis, I'd like to look at the time evolution of the system. I think I can do that pretty easily without using the TimeSeries function by just iterating using Table, but I'd like to visualize the data in a ListPlot where the x axis is wavelength, and all of the absorbance traces are coplotted and colored according to their timestamp. Commented Oct 25, 2022 at 18:59

TemporalData is exactly what you need. You just need to put your data in the proper format. Start from separating your time staps:

times = Range[0, 1000, 100];

Then put values as a List of Lists (matrix), for example some made up values:

values = Table[k + RandomReal[1, 11], {k, 5}]

Now your data are constructed as

data = TemporalData[values, {times}]

Alternatively, because your time stamps are regular you could just do:

data = TemporalData[values, {0, 1000, 100}]

Now plot (note, you can also use DateListPlot if your time stamps are in a proper time-unit format):