我试图在精细的网格上绘制S
。 S
是一个二维数组,其值为SR
和Temp
。我想制作一个SR
和Temp
的精细网格网格,并绘制S
的等高线图。我正在尝试使用RectBivariateSpline
,但在找到Z2
时收到错误。
我得到的错误是:
in line Z2 = zspline(TT,SR)
raise ValueError("Error code returned by bispev: %s" % ier)
ValueError: Error code returned by bispev: 10
我的代码:
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import RectBivariateSpline
T = np.array([850,800,750])
strain_rate = np.array([0.0003,0.001,0.01,0.1])
flow_stress1 = np.array([[28.16, 49.46, 95.96],
[46.45, 80.51, 126.62],
[151.46, 107.94, 235.14],
[165.63, 228.77, 319.15]])
Temp = 1000/(273+T)
TT = np. linspace(max(Temp), min(Temp),50)
S = np.log10(flow_stress1)
SR= np.log10(strain_rate)
srate= np.linspace(min(SR), max(SR),100)
zspline = RectBivariateSpline(SR,Temp,S , kx=2, ky=2)
Z2 = zspline(TT,SR)
fig = plt.figure()
ax = fig.add_subplot(111)
x,y = np.meshgrid(Temp,SR)
ax.contourf(x,y,Z2)
plt.show()
我试过看,但没有找到解决这个问题的令人满意的方法。