Matplotlib 3D Plot with Colored Heights - python

I'm trying to visualise a dataset in 3D which consists of a (along y axis - constant values) of x-z data, using Python and Matplotlib. In other words, I have measured T(t) (z(x)) data of 16 points (y-axis)
I'd like to create something like picture below, I only managed to create enter image description here, but from this is not useful to see the desired peaks.
So ideally I would like to be looking something like this.
enter image description here

Related

Density Plot From 3D Array In Python

For some reason I cannot find any examples online for what I'm trying to do.
I have an array where each point is [x,y,f(x,y)]. The x,y values cover the 2d space evenly and without repeating.
I want to create a 2D density plot where each point is colored according to its z value.
If I plot this data in Mathematica as a 3D surface and look at it from above, it looks like this: https://imgur.com/a/m4Rt0ui
I would like to make this, except 2D and in python.

Plottin a profile based on multiple 2D plots in a 3D scenario

So, I have Multiple plots in 2d from an estimative of depth from a basin I'm studying. I want to plot them in a 3D perspective so I can see the connection between them like lined according to their long/lat. I don't know if I can explain. I tried some interpolations methods To plot the layers as a 3d surface terrain, but none of them gave me the results I was looking for. I hope someone can help me.
These are the profiles
And I would like something like this
The data that I have looks like this:

How do I plot a contour plot of 3 column data

I have a 3 column irregular data in the format [X Y Z]. I am having difficulty in creating a contourf
plot for the same since it requires one to create a meshgrid and also that data be uniform among the grid.
I need some direction or hint to get started.
I am providing two ways in which you can create a contour/density plot for the data which is in 3-column format and irregular, as you have mentioned.
You can use Mathematica: see the documentation of ListDensityPlot. You can directly provide the data as, ListDensityPlot[{{x1,y1,f1},…,{xk,yk,fk}}], and this will plot the sought density plot.
There is also a simple way to do this in python: You can see the documentation of tricontourf, a module of matplotlib. Its functionality is similar to that of contourf, except that you give 1D arrays rather than the data in mesh grid format.

Given a .jpg of 2D colorplot & colorbar, how can I sample the image to extract numerical data?

I have a .jpg of a 2d colorplot & colorbar, similar to something you might make with matplotlib's pcolormesh().
I'd like to 'reverse engineer' the data from the image. Meaning, I'd like to define some sampling grid on the image, pick the color of that sample, and interpolate it to a point on the color bar to obtain a scalar value of that pixel.
I'm wondering how much of this functionality already exists in some form, and how much I'll need to develop.

Python distribution statistics on scatter plot style data

I'm trying to get statistics on a distribution but all the libraries I've seen require the input to be in histogram style. That is, with a huge long array of numbers like what plt.hist wants as an input.
I have the bar chart equivalent, i.e. 2 arrays; one with the x-axis centre points, and one with y-axis values for the corresponding value of each point. The plot looks like this:
My question is how can I apply statistics such as mean, range, skewness and kurtosis on this dataset. The numbers are not always integers. It seems very inefficient to force python to make a histogram style array with, for example, 180x 0.125's, 570x 0.25's e.t.c. as in the figure above.
Doing mean on the current array I have will give me the average frequency of all sizes, i.e. plotting a horizontal line on the figure above. I'd like a vertical line to show the average, as if it were a distribution.
Feels like there should be an easy solution! Thanks in advance.

Categories