I have an ASCII file with multiple datablocks separated by newlines. Each datablock is the same size. I would like to plot each datablock as a separate heat map. I've been trying variations on the following command to plot the first block:
plot data matrix every :::0::0 w image
But gnuplot segfaults with this command. If I delete all datablocks except one, then I can plot that single block with
plot data matrix w image
How should I modify that first command to pick out an individual datablock? In the end, I would like to write a loop to produce individual plots for each datablock.
To my opinion there is a bit confusion about "datablock", "dataset", "data", etc...
If your "blocks" are separated by more than one empty line you can address it with index
, check help index
. If the "blocks" are separated by one line you can address them via every
, check help every
.
Code:
### plotting "datablocks"
reset session
$Data <<EOD
1 0
0 1
1 1
1 0
0 1
0 0
1 1
0 1
EOD
unset colorbox
set multiplot layout 2,2
do for [i=0:3] {
set title sprintf("Block %d",i)
plot $Data index i matrix w image notitle
}
unset multiplot
### end of code
Result: