0

I have different experimental observations and I want to plot only the average curve (in python). The main problem is that each observation can have different number of points.

Any help would be greatly appreciated. Simple example to elaborate the problem:

One observation: x1 = [0,1,2,3], y1 = [3, 2, 1, 0] => plot(x1,y1)

Second observation: x2 = [0, 2, 3], y2 = [3,1,0] => plot(x2,y2)

Now we need to plot average curve only.

I believe we need to find the curve/line for each observation and then take the average curve. But not sure how to do that. Please help!

  • Is the intention to plot the mean from each dataset? For example if you have 5 datasets, which might have a different number of trials/sample points each, you would like to make a single plot that represents the mean of the 5 datasets? – Calvin Drawbridge May 03 '20 at 14:34
  • Also, what does x represent? Is the data time-series with missing sample points? – Calvin Drawbridge May 03 '20 at 14:36
  • @CalvinDrawbridge I would like to make a single plot that represents the mean of the 5 datasets. For exmple: plt.plot([1,2,3],[1,2,3]); plt.plot([0,1,2,3],[0,1,2,3]); plt.plot([2,3,4,5,6],[2,3,4,5,6]) and so on. This will give us several curves, each representing one trial/experiment and I need only average plot for all these. This is not time series data. Problem: in supply chain network, we have to plot disrupted suppliers on x-axis (0 to 100% disruption) versus remaining buyers on y-axis (100 to 0% disruption). – Vinod Kumar Chauhan May 03 '20 at 14:59

1 Answers1

0

I found the answer here: How to interpolate a line between two other lines in python The answer is based on interpolation of all observations to equal number of points. Thank you!