我使用matplotlib以二维直方图的形式绘制一些数据。我的脚本的典型输出如下所示:
脚本的相关部分如下:
xbins = 10**np.linspace(-3, 0, 100)
ybins = 10**np.linspace(-3, 0, 100)
counts, _, _ = np.histogram2d(x1val, x2val, bins=(xbins, ybins))
fig, ax = plt.subplots()
mesh = ax.pcolormesh(xbins, ybins, counts)#, norm=LogNorm())
ax.set_xscale('log')
ax.set_yscale('log')
plt.xlabel('$x_1$')
plt.ylabel('$x_2$')
plt.title(title)
plt.colorbar(mesh)
其中x1val
和x2val
是充满数据的列表,我只想在直方图上绘制一条由一些简单的function x2 = f(x1)
定义的白色曲线。这有可能吗?你知道吗
最好的, 拉德克
目前没有回答
相关问题 更多 >
编程相关推荐