pcolor in matplotlib - python

I am using pcolor in matplotlib. I use a three dimensional array as the input. I want to arrange the third array to be displayed in a log scale. Is there an option to do this? If I take a logarithm of the third array before plotting it, the sub one values become negative and pcolor no longer works.

Related

Problems when plotting arrays on python, instead of plotting full lines it onyl plots dots

I'm having problem when plotting two arrays in python. I have to numpy arrays with same size, one which I will use to set the time and the other one that is a reference siganl. They look like this:
this is the reference siganl array:
This the time array:
But then when i call to the plt.plot command this way:
I obtain the following plot:
Anyone know why it takes each value of the reference array individually? and any solutions for it? Even when I put a legend to the plot, it displays Yr 18 times.

Layer 2D plots into 3D plot in python

I have a 3D array (created by performing 2D scans at different depths), filled with measurement values. Most values are rather low, while some will be locally higher. I would like to plot these like this in python:
But I have not been able to find a good option for that. Note that the pixel size in XY and Z can be different. Matplotlib would be easiest, but I'm open to other options as well.

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.

Matplotlib imshow()

I am stuck with python and matplotlib imshow(). Aim is it to show a twodimensonal color map which represents three dimensions.
My x-axis is represented by an array'TG'(93 entries). My y-axis is a set of arrays dependend of my 'TG' To be precise we have 93 different arrays with the length of 340. My z-axis is also a set of arrays depended of my 'TG' equally sized then y (93x340).
Basically what I have is a set of two-dimensonal measurements which I want to plot in color dependend on a third array. Is there a clever way to do that. I was trying to find out on my own first, but all I found is that most common is the problem with just a z-plane(two-dimensonal plot). So I have two matrices of the order of (93x340) and one array(93). Do you know a helpful advise.
Without more detail on your specific problem, it's hard to guess what is the best way to represent your data. I am going to give an example, hopefully it is relevant.
Suppose we are collecting height and weight of a group of people. Maybe the index of the person is your first dimension, and the height and weight depends on who it is. Then one way to represent this data is use height and weight as the x and y axes, and plot each person as a dot in that two dimensional space.
In this example, the person index doesn't really have much meaning, thus no color is needed.

How to turn off interpolation in pcolormesh()?

I've noticed pcolormesh by default interpolates/smoothes the raw data. How do I turn this off?
Actually it's not invalid. pcolor and pcolormesh are certainly interpolating!
Use pcolor to plot a 4x4 matrix and you will get a 3x3 output.
pcolor is not plotting each matrix entry, but each "output value" is an interpolation of the four surrounding values of the original matrix.
And there is no way to turn this off.

Categories