csvmatrixgnuplotbracketsdata-files

How to gnuplot csv file with data columns including square brackets


I have large datafile in csv format.

#data and time, id, volt, temp
2024-04-11 18:15:11,1,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:15:11,4,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:15:11,5,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:15:11,6,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:15:11,7,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:15:11,10,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:16:11,1,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:16:11,4,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:16:11,5,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:16:11,6,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:16:11,7,[3100,3295,...,3120],[29,27,...,30]
2024-04-11 18:16:11,10,[3100,3295,...,3120],[29,27,...,30]

... greater than 200000 rows!

There are 416 values in each of those brackets. The values change as the time goes. The numbers of 1,4,5,6,7,10 are reference of six fixed equipment tag and are repeated for each minute of time Above is an example of 18:15:11 and then the same id numbers 1,4,5,6,7,10

How would i be able to plot these in gnuplot? I think a basic plot and then something similar to fence plot but stacked would be nice.

Thanks Sina

Well I am stuck how to do it For simple line plots it's fine but i do like to use a kind of script that treats volt and temp bracket as vector matrix. Possibly a surface plot is a suitable choice


Solution

  • Still not sure exactly what you have in mind, but here's a simple line plot (style "linespoints") that pulls the 2nd voltage value at each time point, one line for each instrument. You don't provide enough data in your sample to make a reasonable demo as a fenceplot using plot style "zerror", but see for example zerror documentation in User Manual.

    # Line plot
    # One line for each device numbered 1,4,5,6,7,10 in column 2
    # Height of point at time t is 2nd value in first bracketed array
    
    set datafile separator comma
    set timefmt "%Y-%m-%d %H:%M:S"
    
    set xdata time
    set xlabel "Time"
    set xtics format "%H:%M"
    set xtics 600.  # one tick mark every 10 minutes (600 seconds)
    set xrange ["2024-04-11 18:00" : "2024-04-11 18:20"]
    
    set ylabel "Instrument"   
    set yrange [0:10]
    set ytics (1,4,5,6,7,10)
    
    set zlabel "Voltage point #2" rotate
    
    set view 50,20
    
    set style data linespoints
    splot for [i=0:5] 'brackets.csv' using 1:2:4 every 6::i notitle
    

    enter image description here