This is a variation on a previous post that has not received any responses.
Would it be possible to allow the
plot function to accept an array
y argument that is the same size as a vector
x along one of its dimensions, not just the first? The following code works in MATLAB, for example:
x = linspace(0, 2*pi); % Size: [1 x 100] k = (0:2)'; % Size: [3 x 1] y = sin(k*x); % Size: [3 x 100] plot(x, y) % Second dimensions are the same plot(x, y') % Second dimension of x is the same as first dimension of y'
Matplotlib behaves differently:
x = np.linspace(0, 2 * np.pi) # Shape: (50,) k = np.arange(3). # Shape: (3,) y = np.sin(np.outer(k, x)) # Shape: (3, 50) plt.plot(x, y) # Returns ValueError plt.plot(x, y.T) # y.T has shape (50, 3), compatible with x