plt.hist(norm=1, or density=True)
中尝试了正常函数,然后我得到了一个y轴大小约为2,5的直方图。我知道如果我增大bin大小,我可以降低y轴值,但是我尝试复制的工作没有大于0.2的bin李>x,y=columns of a predetermined table
left, width = 0.1, 0.7
bottom, height = 0.1, 0.7
spacing = 0.05
rect_scatter = [left, bottom, width, height]
rect_histx = [left, bottom + height + spacing, width, 0.2]
rect_histy = [left + width + spacing, bottom, 0.2, height]
plt.figure(figsize=(9, 8))
ax_scatter = plt.axes(rect_scatter)
ax_scatter.tick_params(direction='in', top=True, right=True)
ax_histx = plt.axes(rect_histx)
ax_histx.tick_params(direction='in', labelbottom=True)
ax_histy = plt.axes(rect_histy)
ax_histy.tick_params(direction='in', labelleft=False)
ax_scatter.scatter(x, y, s=30, marker='*')
binwidth = 0.1
ax_scatter.set_xlim((-1, 0.7))
ax_scatter.set_ylim((-0.9, 0.9))
bins = np.arange(-10, 10 + binwidth, binwidth)
ax_histx.hist(x, bins=bins, normed=1, color='chartreuse')
ax_histy.hist(y, bins=bins, orientation='horizontal', normed=1, color='darkmagenta')
ax_histx.set_xlim(ax_scatter.get_xlim())
x_histy.set_ylim(ax_scatter.get_ylim())
我正在处理一个用这个函数绘制的图形的屏幕截图,另一个是我试图实现的一个示例(值不应该是相同的)
如果你还需要什么帮助解决我的问题,请尽管问。谢谢
目前没有回答
相关问题 更多 >
编程相关推荐