近期需要画contour图,好像也叫热图。
注意x,y需要网格化,x.reshape(n,n); y=reshape(n,n)
或者 (x,y)= meshgrid(x,y)
一、无等高线
plt.imshow(f(x,y),cmap=jet); #f(x,y)需要时方阵
二、有等高线
plt.contour(x,y,f(x,y),cmap=jet); #画等高线、轮廓图
plt.contourf(x,y,f(x,y),cmap=jet); #填充颜色
colorbar线条无填充色的问题?
a=plt.contourf(x,y,f(x,y));
plt.colorbar(a);