使用多轴时matplotlib定位xlabel/ylabel(历史+散点)

2024-09-28 22:29:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图创建一个散点图,以散点图左侧和底部的数据直方图为边界。我一直在遵循这个例子(图的顶部和右侧是有边界的): http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html

我已经成功地改变了边距和大小,以得到我想要的直方图,但我不知道如何告诉mpl把xlabel和ylabel放在哪里。例如,使用(现在axHistx和axHisty被修改为位于散点左侧/下方):

axScatter = axes(scat_area)
axHistx = axes(hist_area_x)
axHisty = axes(hist_area_y)
...
xlabel('this is the x axis')
ylabel('this is the y axis')

将xlabel放在左侧直方图的下方(axHisty)。我要它在底部的柱状图下居中。我不能使用axHistx.xlabel(),因为axis对象没有该属性。(不过,我对伊拉贝尔的表现很满意)

current output


Tags: the数据isarea直方图thisexampleshist