0

Essentially trying to represent scatter plots with different number of points in traces for example 3 traces y1,y2,y3 that represent 'y=f(x,z)' but x are not all the same size. Question is how to represent s as an xarray DataArray. My attempts are resulting in errors 'different number of dimensions on data and dims: 0 vs 3' Note the length of x1 and x2 are not the same in the example below

n_traces=3
x1=np.arange (-2,4,1);x2=np.arange(0.5,2,0.5);x3=x2*1.1
y1=x1*2;y2=np.power(x2,1.5)-3;y3=y2*.9
z=[0.5,1,2]
s=tuple(x1)
s=((tuple(x1),tuple(y1)),(tuple(x2),tuple(y2)),(tuple(x3),tuple(y3)))
user15420598
  • 107
  • 7
  • you *almost* have a [mre] here - but please always post the code that generates an error and the [full traceback](//realpython.com/python-traceback) when asking about errors :) – Michael Delgado Jan 12 '22 at 00:12
  • generally, though, the answer is no. you can't e.g. have a variable indexed by `x` which doesn't have all of the values for x. you can index both the value and x by something else, e.g. `observation_number`, if you e.g. always have N (x, y) points, but x and y are not the same for each trace. – Michael Delgado Jan 12 '22 at 03:01

0 Answers0