You can use external tools to calculate the averages of all cells over the blocks. But you can also do it in gnuplot. However, you need to have your data in a datablock. How to get it there, see: gnuplot: load datafile 1:1 into datablock. Assumption is that there are no headers and each subblock has equal number of rows. Check the following example as a starting point.
Code:
### calculate average over blocks for each cell in subblock
reset session
$Data <<EOD
111 112 113 114 115
121 122 123 124 125
131 132 133 134 135
141 142 143 144 145
211 212 213 214 215
221 222 223 224 225
231 232 233 234 235
241 242 243 244 245
311 312 313 314 315
321 322 323 324 325
331 332 333 334 335
341 342 343 344 345
EOD
stats $Data u 0 nooutput
BlockCount = STATS_blocks
ColCount = STATS_columns
RowCount = STATS_records/STATS_blocks
Cell(b,r,c) = real(word($Data[b*(RowCount+2) + r],c))
CellAvg(r,c) = (sum [_b=0:BlockCount-1] (Cell(_b,r,c)))/BlockCount
set print $Avg
do for [r=1:RowCount] {
Line = ''
do for [c=1:ColCount] {
Line = sprintf("%s %g",Line,CellAvg(r,c))
}
print Line
}
set print
set key noautotitle
set palette defined (0 "green", 1 "yellow")
plot $Avg matrix u 1:2:3 w image, \
'' matrix u 1:2:(sprintf("%g",$3)) w labels
### end of code
Result:
