I have the result of some computations made with numpy.matrix types
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = Axes3D(fig)
# [...]
# Downsampling for plotting
# type(verts): np.matrix
# verts.shape: (3, 700000)
verts = verts_small[:, ::1000]
ax.plot(verts[0, :], verts[1, :], verts[2, :], 'o')
This has strange behavior. Plots the points all in a line.
If instead:
verts = np.array(verts[:, ::1000])
the 3D-plot works as expected. Is this an intended behavior or is it a bug?
np.matrixthe result will still be 2d. Anp.ndarraymaybe 1d (depending on how you index).np.matrix" is in general, not a surprise. Writing code that deals with np.matrix is difficult, because it resists conversion to 1d arrays. There's talk of deprecatingnp.matrixin an immintent release, but we're not there yet. Either way, I'd strongly suggest not using it anyway.np.matrixbundles a semi-useful feature, that*always meansnp.dot, with the very frustrating one that everything is 2dsome_matrix.reshape((2, 1, 3, 1)).shape != (2, 1, 3, 1)is just downright evilv.T*u, normv.T*v, linear operatorA*v, matrix x matrixA*B. Everything comes flawlessly. :). But I believe it's a matter of opinions, and maybe there are some applications where this is unwanted. Thanks for the fruitful discussion.