matplotlib实现热成像图colorbar和极坐标图的方法
程序员文章站
2022-12-19 10:35:13
热成像图
%matplotlib inline
from matplotlib import pyplot as plt
import numpy as np...
热成像图
%matplotlib inline from matplotlib import pyplot as plt import numpy as np def f(x, y): return (1 - x / 2 + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2) n = 10 x = np.linspace(-3, 3, 4 * n) y = np.linspace(-3, 3, 3 * n) x, y = np.meshgrid(x, y) plt.imshow(f(x, y), cmap='hot', origin='low') plt.colorbar(shrink=.83) plt.xticks(()) plt.yticks(())
极坐标图
%matplotlib inline from matplotlib import pyplot as plt import numpy as np ax = plt.subplot(1, 1, 1, polar=true) #ax = plt.plot( polar=true) n = 20 theta = np.arange(0.0, 2 * np.pi, 2 * np.pi / n) radii = 10 * np.random.rand(n) width = np.pi / 4 * np.random.rand(n) bars = plt.bar(theta, radii, width=width, bottom=0.0) for r,bar in zip(radii, bars): bar.set_facecolor(plt.cm.jet(r/10.)) bar.set_alpha(0.5) ax.set_xticklabels([]) ax.set_yticklabels([])
以上这篇matplotlib实现热成像图colorbar和极坐标图的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。