Message Boards Message Boards

GROUPS:

Shade a submatrix within a matrix

Posted 8 months ago
1465 Views
|
4 Replies
|
5 Total Likes
|

I am using the free version of the Wolfram Alpha Mode Notebook. In it I have an 11 x 11 matrix and I would like to shade a sub-matrix, 4 x 4 sub-matrix, within the 11 x 11 matrix.

Could you please point me to an example or some documentation that illustrates how this is done.

Thanks.

4 Replies

If you are willing to wrap your matrix in Grid, you can do something like this:

Grid[RandomInteger[{1, 8}, {11, 11}], 
 Background -> {None, None, {{{4, 7}, {6, 9}} -> LightRed}}]
Posted 8 months ago

You could try applying a Style to the elements

SeedRandom[123];
r = RandomInteger[{1, 8}, {11, 11}];

MapAt[Style[#, Red, 16] &, r, {4 ;; 7, 6 ;; 9}] // MatrixForm

enter image description here

Thanks Seth.

Thanks Rohit ... it worked great.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract