[英]Val Error, x and y must have the same dimension. [I tried to do np.array but it hasn't helped]
[英]Error: x and y must have same first dimension. Why?
为什么我会收到错误消息:“x 和 y 必须具有相同的第一维,但具有形状 (15,) 和 (23,)”?
index = np.where(A3_Fixed == 0)[0]
for x in index:
A2.pop(x)
A3_Fixed.pop(x)
A4_Fixed.pop(x)
A5_Fixed.pop(x)
A6_Fixed.pop(x)
plt.plot(A2, A3_Fixed, color="brown", label="Pasta In P1", marker="o")
plt.plot(A2, A4_Fixed, color="brown", linestyle=":", label="Pasta Out P1", marker="o")
plt.plot(A2, A5_Fixed, color="green", label="Líquido de Lavagem P1", marker="o")
plt.plot(A2, A6_Fixed, color="green", label="Filtrado P1", linestyle=":", marker="o")
如果A2
和A3_fixed
是列表,您可以通过执行以下操作确保它们的大小相同,并查看您的问题是否仍然存在。 如果是这样,那么不知何故,您的x
和y
值的数量不一样,正如 pavel 在他们的评论中提到的那样。
# limit both lists to the size of the smaller one
A2 = [:min(len(A2),len(A3_fixed))]
A3_fixed = [:min(len(A2),len(A3_fixed))]
您也可以通过调用print(len(list_name))
在尝试 plot 之前检查每个权利的长度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.