I want to plot the result of a numerical method for a three dimensional system of ODEs. My output is in the form (let's suppose we have computed three steps):
import numpy as np
v= np.array([[1,2,3], [4,5,6], [7,8,9]])
Where the first value in every 3-tuple is the x coordinate, the second is y coordinate and the third is the z coordinate.
I would like the most simple and efficient way of plotting these points on a 3D grid. The problem seems to be that the data should be formated like np.array([[1,4,7], [2,5,8], [3,6,9]])
.
You can plot the result in 3D like this:
import matplotlib.pyplot as plt, numpy as np
from mpl_toolkits.mplot3d import Axes3D
v= np.array([[1,2,3], [4,5,6], [7,8,9]])
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(v[:,0],v[:,1],v[:,2])
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With