Matplotlib 3D hypocenter plot, reading xyz values ​​from a .txt file

I am trying to learn python. I have real coordinates xy (lat long dd) and z (km below the surface) values ​​for about 500,000 earthquakes (hypocenter) from M 0.1 to 2.0. I interrupted data up to 10 rows of xyz values ​​in a table with tab delimiters .txt. I want to build data in a 3d chart with the ability to rotate in matplotlib. I can use basic commands to read data, and the format looks great. I do not understand if I need to read data into a list or an array for mpl to read and build data. Do I need to create an array?

Then I want to build a subsurface location of the oil well, given the xyz coordinates of the vertices along the wellbore (about 40 positions), do I need to create a polyline ?. These data have the same common coordinates (which will be evaluated later) as some of the giptones. What data set should be the plot, and what should be the subplot? In addition, I do not know what “floating” I need is from 6 to 7 decimal places, and the coordinates are 2 decimal z.

+3
source share
1 answer

Matplotlib is a bad choice for this. This does not allow true 3D graphics, and it will not handle the complexity (or the number of points in 3D) that you need. Take a look at mayavi instead.

, , ? ( , .)

:

from enthought.mayavi import mlab
import numpy as np

# Generate some random hypocenters
x, y, z, mag = np.random.random((4, 500))

# Make a curved well bore...
wellx, welly, wellz = 3 * [np.linspace(0, 1.5, 10)]
wellz =  wellz**2

# Plot the hypocenters, colored and scaled by magnitude
mlab.points3d(x, y, z, mag)

# Plot the wellbore
mlab.plot3d(wellx, welly, wellz, tube_radius=0.1)

mlab.show()

enter image description here

, , , :

x, y, z = np.loadtxt('data.txt').T

?

+4

All Articles