# 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: **94 times**

Last updated: **Feb 26**

Drawing all paths from (0, 0) to (n, n) moving one unit right or up

How do I display the full output that includes graphics?

Mystery white border around Graphics object

Insert image into Graphics object

How to make pygraphviz and sage compatible?

Show long expressions in interactive shell

Plotting a frequency chart from a set of values

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.