Now I want to reshape it to a single matrix so that I can have the groups in rows (but only the values, not as a matrix). I want to plot the 4x4 matrices next to each other in a single plot with matplotlib's imshow function, so it should look like this:
[[ 1., 1., 2., 2., 3., 3., 4., 4.],
[ 1., 1., 2., 2., 3., 3., 4., 4.],
[ 5., 5., 6., 6., 7., 7., 8., 8.],
[ 5., 5., 6., 6., 7., 7., 8., 8.],
[ 9., 9., 10., 10., 11., 11., 12., 12.],
[ 9., 9., 10., 10., 11., 11., 12., 12.],
[13., 13., 14., 14., 15., 15., 16., 16.],
[13., 13., 14., 14., 15., 15., 16., 16.]]
I would like to use only the NumPy functions and avoid for-loops for performance reasons, but if that's not possible then how to solve it.