# MatrixPlots with cell entries

Is there a nice way to combine `MatrixPlot`

with something else to have a label in each cell such as in this picture?

MatrixPlots with cell entries

`MatrixPlot`

with something else to have a label in each cell such as in this picture?

add a comment

1

Something like this works:

```
# make some random matrix
A = random_matrix(ZZ,7,7)
# make a graphics object consisting of the values of A
g = sum([text(str(A[j,k]),(j,k)) for j in range(7) for k in range(7)])
# matrix plot A and then combine with the text
g2=matrix_plot(A,cmap='rainbow',colorbar=True)
h = g2+g
# for some reason the graphics window resizes to the shape of the added text graphics
# regardless of whether h = g + g2 or h = g2 + g
h.SHOW_OPTIONS['xmax'] = 6.5
h.SHOW_OPTIONS['xmin'] = -.5
h.SHOW_OPTIONS['ymax'] = 6.5
h.SHOW_OPTIONS['ymin'] = -.5
# show result
h.show()
```

Image here: https://imgur.com/a/czhRS (I don't have enough points to embed it).

Asked: **
2018-02-22 11:19:50 -0600
**

Seen: **227 times**

Last updated: **Feb 26 '18**

How do I display the full output that includes graphics?

__init__() takes exactly 5 arguments (4 given) error in contour plot

Mystery white border around Graphics object

Problem with plotting "lambda" functions

can't append to graphics object

plot unions, intersections, etc.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.