matplotlib条形图调整条形方向

时间:2015-05-27 11:23:48

标签: python matplotlib plot axes

我想从底部开始吧。如何将起点从零更改为例如-2?

我的代码:

import matplotlib.pyplot as plt
import numpy as np


N=1000
sample=np.random.random_integers(1,10,N)
hist,bins=np.histogram(sample)

plt.bar(bins[:-1],np.log10(1.*hist/N),np.diff(bins))

plt.show()

输出: enter image description here

1 个答案:

答案 0 :(得分:1)

试试这个:

<button ng-click="load()"> Load data 1.000 times </button> <script> var callback = true; var count = 0; function ajaxRequest(i){ //AJAX REQUEST .success(function(){ count++; if(count == 1000){ callback = true; count = 0; } }); } $scope.load = function(){ if(callback){ callback = false; for(var i = 0; i < 1001; i++){ ajaxRequest(i); } } } </script>