Message Boards Message Boards

0
|
6674 Views
|
4 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Shade a submatrix within a matrix

Posted 4 years ago

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.

POSTED BY: Thomas Vermaak
4 Replies
Posted 4 years 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

POSTED BY: Rohit Namjoshi

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 BY: Seth Chandler

Thanks Seth.

POSTED BY: Thomas Vermaak

Thanks Rohit ... it worked great.

POSTED BY: Thomas Vermaak
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