Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

As Pinguin DirkPinguin Dirk comments there is an example of exactly this in the documentation:

Grid[Table[x, {4}, {7}],
  Background -> {None, None, {{1, 1} -> Pink, {3, 3} -> Red}}]

enter image description here

Those who value brevity may wish to note that implicit Null may be used in place of None:

Background -> {, , {{1, 1} -> Pink, {3, 3} -> Red}}

You can also use Item and MapAt:

tbl = Table[x, {4}, {7}];

MapAt[Item[#, Background -> Pink] &, tbl, {{3, 3}, {2, 6}}] // Grid

enter image description here

You could also use Style but that won't fill the cell (can be finetuned by using Pane though):

{Grid[{{1, 2}, {3, Style[4, Background -> Pink]}}, Frame -> All],
 Grid[{{1, 2}, {3, Item[4, Background -> Pink]}}, Frame -> All]}

enter image description here

As Pinguin Dirk comments there is an example of exactly this in the documentation:

Grid[Table[x, {4}, {7}],
  Background -> {None, None, {{1, 1} -> Pink, {3, 3} -> Red}}]

enter image description here

Those who value brevity may wish to note that implicit Null may be used in place of None:

Background -> {, , {{1, 1} -> Pink, {3, 3} -> Red}}

You can also use Item and MapAt:

tbl = Table[x, {4}, {7}];

MapAt[Item[#, Background -> Pink] &, tbl, {{3, 3}, {2, 6}}] // Grid

enter image description here

You could also use Style but that won't fill the cell (can be finetuned by using Pane though):

{Grid[{{1, 2}, {3, Style[4, Background -> Pink]}}, Frame -> All],
 Grid[{{1, 2}, {3, Item[4, Background -> Pink]}}, Frame -> All]}

enter image description here

As Pinguin Dirk comments there is an example of exactly this in the documentation:

Grid[Table[x, {4}, {7}],
  Background -> {None, None, {{1, 1} -> Pink, {3, 3} -> Red}}]

enter image description here

Those who value brevity may wish to note that implicit Null may be used in place of None:

Background -> {, , {{1, 1} -> Pink, {3, 3} -> Red}}

You can also use Item and MapAt:

tbl = Table[x, {4}, {7}];

MapAt[Item[#, Background -> Pink] &, tbl, {{3, 3}, {2, 6}}] // Grid

enter image description here

You could also use Style but that won't fill the cell (can be finetuned by using Pane though):

{Grid[{{1, 2}, {3, Style[4, Background -> Pink]}}, Frame -> All],
 Grid[{{1, 2}, {3, Item[4, Background -> Pink]}}, Frame -> All]}

enter image description here

added Style
Source Link
István Zachar
  • 47.2k
  • 20
  • 145
  • 293

As Pinguin Dirk comments there is an example of exactly this in the documentation:

Grid[Table[x, {4}, {7}],
  Background -> {None, None, {{1, 1} -> Pink, {3, 3} -> Red}}]

enter image description here

Those who value brevity may wish to note that implicit Null may be used in place of None:

Background -> {, , {{1, 1} -> Pink, {3, 3} -> Red}}

You can also use Item and MapAt:

tbl = Table[x, {4}, {7}];

MapAt[Item[#, Background -> Pink] &, tbl, {{3, 3}, {2, 6}}] // Grid

enter image description here

You could also use Style but that won't fill the cell (can be finetuned by using Pane though):

{Grid[{{1, 2}, {3, Style[4, Background -> Pink]}}, Frame -> All],
 Grid[{{1, 2}, {3, Item[4, Background -> Pink]}}, Frame -> All]}

enter image description here

As Pinguin Dirk comments there is an example of exactly this in the documentation:

Grid[Table[x, {4}, {7}],
  Background -> {None, None, {{1, 1} -> Pink, {3, 3} -> Red}}]

enter image description here

Those who value brevity may wish to note that implicit Null may be used in place of None:

Background -> {, , {{1, 1} -> Pink, {3, 3} -> Red}}

You can also use Item and MapAt:

tbl = Table[x, {4}, {7}];

MapAt[Item[#, Background -> Pink] &, tbl, {{3, 3}, {2, 6}}] // Grid

enter image description here

As Pinguin Dirk comments there is an example of exactly this in the documentation:

Grid[Table[x, {4}, {7}],
  Background -> {None, None, {{1, 1} -> Pink, {3, 3} -> Red}}]

enter image description here

Those who value brevity may wish to note that implicit Null may be used in place of None:

Background -> {, , {{1, 1} -> Pink, {3, 3} -> Red}}

You can also use Item and MapAt:

tbl = Table[x, {4}, {7}];

MapAt[Item[#, Background -> Pink] &, tbl, {{3, 3}, {2, 6}}] // Grid

enter image description here

You could also use Style but that won't fill the cell (can be finetuned by using Pane though):

{Grid[{{1, 2}, {3, Style[4, Background -> Pink]}}, Frame -> All],
 Grid[{{1, 2}, {3, Item[4, Background -> Pink]}}, Frame -> All]}

enter image description here

Source Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

As Pinguin Dirk comments there is an example of exactly this in the documentation:

Grid[Table[x, {4}, {7}],
  Background -> {None, None, {{1, 1} -> Pink, {3, 3} -> Red}}]

enter image description here

Those who value brevity may wish to note that implicit Null may be used in place of None:

Background -> {, , {{1, 1} -> Pink, {3, 3} -> Red}}

You can also use Item and MapAt:

tbl = Table[x, {4}, {7}];

MapAt[Item[#, Background -> Pink] &, tbl, {{3, 3}, {2, 6}}] // Grid

enter image description here