这是我的代码
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d.axes3d import Axes3D
#Read data from file "data.txt" in float format
arregloCompleto=[]
archivo = open("data.txt","r")
while True:
linea = archivo.readline()
lineArray = linea.replace("\n","").split(',')
for i in range(len(lineArray)):
#Read only numbers
if(lineArray[i]!= ""):
arregloCompleto.append(float(lineArray[i]))
if not linea: break
#Generation X, Y
a = np.mgrid[0:(1271)*0.7142:0.7142]
b = np.mgrid[0:(1015)*0.7142:0.7142]
X, Y = np.meshgrid(a,b)
#Graph
fig = plt.figure()
ax1 = fig.gca(projection= '3d')
ax1.plot(X,Y,arregloCompleto)
plt.title('Imagen sobre una grafica 3D')
plt.xlabel('Eje x')
plt.ylabel('Eje y')
plt.show()
此代码中的错误是:
raise ValueError('third arg must be a format string')
ValueError: third arg must be a format string