I have a matrix in .csv format with the first row being temperatures and the first column wavelengths. The z-values in the matrix are intensities. I am trying to import the matrix into python and plotting the 3D surface. I tried doing it in excel but there is a limit to the y-values it can plot. Can someone please assist me with this. I tried multiple sources but my difficulty lies in importing the matrix as it is into python, especially the z-values. Matrix.csv
Related
I have an abaqus inp file with nearly a million elements of 10 node(quadratic) tetrahedron mesh. It is a very complicated model. Can you please help me with plotting the 3D volume mesh in python and also map the stress or strain values to the respective elements? I have to plot the mesh and stress/strain values in python because I need to run many iterative simulations with different loading conditions and compare the results.
Thanks in advance
A small snippet of the inp file.
I'm looking for a way to interpolate 2D fields that are arranged on a list, making the shape data = [11,2016,2016]
Up to the moment I've managed to stack the 2D plots over the Z axis and create an interactive plot, but i want to create a plot of the volume and thought that an interpolation through the 11 steps would work, I'd like to get only one 2D array at the end to plot.
Any suggestions about how to perform this? can I make it on one single operation or am I obliged to perform step by step interpolations between each step?
edit: a picture showing the image that i'm able to generate now and can maybe explain better my problem.
I have a fortran program that simulates some kind of radiation in the air and the signal obtained in each of the antennas at the ground. I am reading the output data with Python3, and one of the output .dat files holds information about the antennas, and it is organized in columns (Position along X-axis, Position along Y-axis, Signal detected, etc).
Supose that I have ~ 1000000 antennas and I have already storaged the position and signal of every one of them in the lists column_x ,column_y,signal and my objective is to reproduce a plot like the following:
How can I do that?
I tried to make a matrix with shape (len(column_x),len(column_y)), insert the values of the list signal in each place of the antenna and plot that matrix with plt.pcolor but I had a lot of issues. There must be an easiest way.
What you intend to do is exactly what matplotlib.pyplot.scatter can do:
import matplotlib.pyplot as plt
plt.scatter(column_x, column_y, c=signal)
I have an input data with each row having (x,y,z,data), i.e., each coordinate (x,y,z) has a value "data". I would like to make a slicing volumetric graph like below in python. I am new to python, any tips would be much appreciated. see here for the example graph
If you have your data organized as a 2D array (n-points x 4) [x,y,z,data] (this can also be refered to as a point-cloud representations) and you want to display it as a volume rendering. You have to first resample it as a 3D array (interpolate 3D volume with numpy and or scipy) and then create an isosurface using marching cubes (How to display a 3D plot of a 3D array isosurface in matplotlib mplot3D or similar?)
You can also plot the values using a 3D scatter plot which is much easier, but won't get you the kind of plot you asked for (https://matplotlib.org/examples/mplot3d/scatter3d_demo.html)
I currently have a heat map which is a 2D float matrix (list of lists of floats to be accurate), and I can display it in 2D with matplotlib fairly easily, but I would like to display it in a 3D plot such that the column and row indices can by the X and Y values respectively, and the values in the matrix are Z (elevation) values. What can I use to do that? I tried using Axes3D but it didn't seem very suitable (or maybe I was using it wrong?). What I am looking to do is conceptually very simple, to pretend the matrix is a DEM and display it as such.
Also if possible I would like to be able to change viewing angles on-the-fly, without having to re-generate the plot.
Any ideas?
These two questions are related but don't quite answer my question:
3d plotting with python
Python: 3D contour from a 2D image - pylab and contourf
NB: The float matrix is rather large, typically 100x100 or more, and the last time I tried to plot it in 3D my system ran out of memory and started thrashing.
Your use case seems like it is tailor made for mayavi/mlab, which has a function that does exactly what you are asking and by default permits interactive 3D rotation:
import numpy as np; from mayavi import mlab
data = np.random.random((100,100))
mlab.surf(data)
mlab.show()