Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Something like this works:

A = random_matrix(ZZ,7,7)
g = sum([text(str(A[j,k]),(j,k)) for j in range(7) for k in range(7)])

g2=matrix_plot(A,cmap='rainbow',colorbar=True) 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 h.show()

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 h.show()

# show result h.show()

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).