
import numpy as npfrom matplotlib import pylab as pldataOne = get_data_one()dataTwo = get_data_two()hN = pl.hist(dataTwo,orIEntation='horizontal',normed=0,rwIDth=0.8,label='ONE')hS = pl.hist(dataOne,bins=hN[1],label='TWO')for p in hS[2]: p.set_wIDth( - p.get_wIDth())xmin = min([ min(w.get_wIDth() for w in hS[2]),min([w.get_wIDth() for w in hN[2]]) ])xmin = np.floor(xmin)xmax = max([ max(w.get_wIDth() for w in hS[2]),max([w.get_wIDth() for w in hN[2]]) ])xmax = np.ceil(xmax)range = xmax - xmindelta = 0.0 * rangepl.xlim([xmin - delta,xmax + delta])xt = pl.xticks()n = xt[0]s = ['%.1f'%abs(i) for i in n]pl.xticks(n,s)pl.legend(loc='best')pl.axvline(0.0)pl.show()总结
以上是内存溢出为你收集整理的python – matplotlib中的背对背直方图全部内容,希望文章能够帮你解决python – matplotlib中的背对背直方图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)