|
From: Ethan M. <eam...@gm...> - 2018-11-08 22:07:10
|
On Thu, Nov 8, 2018 at 12:17 PM theozh <th...@gm...> wrote:
> Thank you, Ethan
> very interesting construct!
> For certain types of data it works.
>
> However, what I couldn't yet get to work is how to plot row data of the
> following type:
>
> $Data <<EOD
> # spectral data as function of time in rows
> Wav 400 500 600 700 800
> t01 1.1 1.2 1.3 1.4 1.5
> t02 2.1 2.2 2.3 2.4 2.5
> t03 3.1 3.2 3.3 3.4 3.5
> EOD
>
I have scripts that I use to plot *.csv files similar to this that are
generated
by a piece of equipment in the lab.
I agree that it would be nice to have an automatic "transpose" button or
command since opening up each *.csv file to do it in Excel is an annoying
detour. My gnuplot scripts, although ugly, can handle the raw files.
Your case is a little worse because the first column is non-numeric.
Nevertheless here is a modified version of one of my scripts that plots
your data by rows. Unfortunately the non-numeric 1st column causes it to
print warning messages.
Ugly? You bet. But it works, except for extracting labels from the row
headers.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$Data <<EOD
# spectral data as function of time in rows
Wav 400 500 600 700 800
t01 1.1 1.2 1.3 1.4 1.5
t02 2.1 2.2 2.3 2.4 2.5
t03 3.1 3.2 3.3 3.4 3.5
EOD
array xval[10]
stats $Data matrix using 1:(xval[$1+1]=$0,$0) every :::0::0 nooutput
cols = STATS_records
rows = |$Data| - 2
print cols, " X values: ", xval
set xrange [xval[2] : xval[cols]]
show xrange
set style data linespoints
plot for [row=1:rows] $Data matrix using (xval[$1+1]):($3) every
:::row::row title sprintf("Row %d",row)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|