简体   繁体   中英

matplotlib - positioning xlabel/ylabel when using multi axes (hist + scatter)

I'm attempting to create a scatter plot bounded by histograms of the data to the left and bottom of the scatter plot. I have been following this example (where the plot is bounded to the top and right): http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html

I have successfully changed the margins and sizes to get the histograms where I want them, but I'm not sure how to tell mpl where to put the xlabel and ylabel. For example, using (where now axHistx and axHisty are modified to be left of/below the scatter):

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')

Will place the xlabel below the histogram on the left ( axHisty ). I want it centered under the histogram on the bottom. I cannot use axHistx.xlabel() since axes objects do not have that attribute. (I am happy with where the ylabel has eneded up, though)

电流输出

这应该工作:

axHisty.set_xlabel("this is the x axis")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM