I'm a beginner in Python. My aim is to create a 3D animation in which the position vector (in 3D coordinate system) would follow the trajectory of a parametrized curve as the parameter t moves from a to b. I know that matplotlib has a 3D animation toolkit but still I wonder if such work is within its capabilities.
I'd be glad to hear your opinion.
Related
I want to construct an environment that is consists of many 3D polygons to represent buildings in a city and 3D moving spheres to represent moving drones.
Which of these tools is the best for this task? Matplotlib, PyOpenGL, PyPRT or Open3D.
I have tried on Matplotlib by constructing these 3D polygons with many surfaces, but that leads to a very very laggy figure when displaying it.
My particular case is that I am trying to make a 3D space-time diagram of a 2D cellular automata. If anybody has any advice/clever ways of representing this visually that would be awesome, but to make the question more general I'll phrase it as...
What is the best way to plot a sort of 3D chessboard or Swiss Cheese type pattern where the white squares are transparent (or vice versa)?
I have looked around and have found ways to plot Imshow type plots on a 3D coordinate system, but it was kind of clunky, slow, and I couldn't get the transparency to work (didn't try masks, but it didn't seem like what I wanted, but I could be wrong).
I have also used a scatter plot where I have a point at (x,y,z) if cell (x,y) is in the active state at time z (also tried the other way around...). This actually managed to render and looked pretty cool, but for the wrong reasons since it was hard to see anything on and was hard to angle properly due to the amount of points on the scatter plots making it lag.
Thanks in advance for any advice.
I'm trying to plot a satellite orbit around the Earth. This is what I currrently have:
I made this plot using the Axes3D function in mpl_toolkits.mplot3d. Ideally what I would like to do, is to replace the simple sphere with an actual Earth with topology.
If you're not sure what I mean, take a look at a MATLAB implementation:
http://uk.mathworks.com/matlabcentral/fileexchange/13823-3d-earth-example
The Basemap package could be of help (especially the bluemarble() function), but unforunately I can't make it work on 3D objects. There is a similar question here, but the answer to that question results in a projection of a 3D sphere on a 2D plot. I want a 3D sphere on a 3D plot, so that I'm able to rotate around it.
Does anybody know of another package/implementation. Or is there a way to make Basemap work with 3D objects?
---EDIT---
Somebody asked the same question, but nobody has answered it yet
I have asked something similar some times ago
PyOpenGL sphere with texture
If I were you I would pick a OpenGL and use a texture of Earth on it just like this one
https://i.stack.imgur.com/ojwD8.jpg
In any case there is my second thread where I needed to make a Mars planet which is basically the same as you want except different texture:
Why my texture is not showing PyOpenGL
I have an array of points (x,y,z) that I would like to animate in 3D using Mayavi (Python). I am currently using a Plot3D command to plot all of the points simultaneously (modeling the movement of a particle), but would love some help on the animation.
Thanks!
Matplotlib offers a lot of possibilities for animation. Have a look at the specific routines for animation. In particular, there's a specific example for 3D plotting.
There are quite a few tutorials on the 'web. Eg. Matplotlib Animation Tutorial and Animated 3-D Plots in Python
I am trying to plot the wave function for a particle in a 3D box. This requires me to plot 4 variables: x, y, z axes and the probability density function.
The probability density function is:
abs((np.sin((p*np.pi*X)/a))*(np.sin((q*np.pi*Y)/b))*(np.sin((r*np.pi*Z)/c)))**2
I am using np.arange() for the X, Y and Z.
I have read that to do this you need to plot the surface of a 4D plot.
Here is what it is supposed to look like:
You want to plot a 3D scalar field f(x,y,z) against all three spatial coordinates.
I am not sure what you're precisely willing to do: which surfaces are you talking about ? You may want to plot iso-density surfaces, which allow for clear visualization of the field.
I don't know the Matplotlib formulation for this, but with Mayavi2 (a great 3D-plotting Python library) you can use "contour3d" :
http://docs.enthought.com/mayavi/mayavi/auto/mlab_helper_functions.html#mayavi.mlab.contour3d
Anyway if you're willing to do advanced 3D stuff Mayavi is way better than Matplotlib.
See the gallery for examples :
http://docs.enthought.com/mayavi/mayavi/auto/examples.html
Hope that helps !
Are these plots essentially plots allowing three of the variables to vary freely while fixing one of the variables and then cycling through all four? If so then these plots could be achieved using matplotlib.Axes3d or the like?