# matplotlib don't work??

```
import matplotlib.pyplot as plt
A = matrix([[1,2,3],[4,5,6],[7,8,9]])
plt.matshow(A)
```

What am I missing?

matplotlib don't work??

```
import matplotlib.pyplot as plt
A = matrix([[1,2,3],[4,5,6],[7,8,9]])
plt.matshow(A)
```

What am I missing?

4

Sage matrices aren't the same as numpy matrices.

```
sage: A = matrix([[1,2,3],[4,5,6],[7,8,9]])
sage: type(A)
<type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
sage: parent(A)
Full MatrixSpace of 3 by 3 dense matrices over Integer Ring
sage: import numpy
sage: B = numpy.matrix([[1,2,3],[4,5,6],[7,8,9]])
sage: type(B)
<class 'numpy.matrixlib.defmatrix.matrix'>
```

In this case, though, it's easy enough to convert the Sage matrix into something that numpy will like (an array, not a matrix, but that shouldn't matter here):

```
sage: A.numpy()
array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
sage: type(A.numpy())
<type 'numpy.ndarray'>
sage: plt.matshow(A.numpy())
<matplotlib.image.AxesImage object at 0x10dad0090>
```

Asked: **
2011-05-15 02:38:31 -0600
**

Seen: **352 times**

Last updated: **May 22 '11**

Smith-McMillan Form of a polynomial matrix

Vertical and horizontal span on plots

How can matplotlib graph axis be moved?

Decrease accuracy for floats (decrease decimal places reported)

Random positive definite matrix

Keeping zeros after matrix multiplication

How do I get the result of right_kernel into a matrix?

what happened to the original question?!

I've restored it (more or less) from the revision history. @Sagud, if you have a new question (about animate?) please ask a new question rather than changing an old one.