标签:ace png orm form its range config tool cmap
总结了一下网上现有的资源,得到了一些东西。随手做个备忘。
import matplotlib.pyplot as plt
from pylab import mpl
mpl.rcParams[‘font.sans-serif‘] = [‘Noto Sans SC‘] # 避免中文在Linux下出现方框
%matplotlib inline
%config InlineBackend.figure_format = ‘svg‘
# 保存图片
plt.savefig("pict.png", bbox_inches=‘tight‘)
plt.show()
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = Axes3D(fig)
x=np.arange(-2*np.pi,2*np.pi,0.1)
y=np.arange(-2*np.pi,2*np.pi,0.1)
X, Y = np.meshgrid(x, y) #网格的创建,这个是关键
Z=np.sin(X)*np.cos(Y)
plt.xlabel(‘x‘)
plt.ylabel(‘y‘)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=‘rainbow‘)
plt.show()
最终图像:
标签:ace png orm form its range config tool cmap
原文地址:https://www.cnblogs.com/samhx/p/matplotlib.html