[英]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.