Can you try to isolate which segment is giving the error (as you use plot and scatter plots) and for that, can you reshape the values you pass to Matplotlib?
Eg:
import numpy as np
import matplotlib.pyplot as plt
x = np.random.rand(24,20)
x = x[:, :-1]
print(x.shape)
x = x.mean(axis=0)
y = np.arange(1, 17) / 192 * 24
#plt.plot(x,y)  #x and y must have same first dimension, but have shapes (19,) and (16,)
y = np.arange(1, 20) / 192 * 24
plt.plot(x,y)  #This works