@@ -5739,7 +5739,6 @@ def hist(self, x, bins=10, normed=False, cumulative=False,
57395739 ccount += 1
57405740 elif orientation == 'vertical' :
57415741 for m in n :
5742-
57435742 color = colors [ccount % len (colors )]
57445743 patch = self .bar (bins [:- 1 ]+ boffset , m , width = width ,
57455744 bottom = bottom , align = 'center' , log = log ,
@@ -5762,13 +5761,36 @@ def hist(self, x, bins=10, normed=False, cumulative=False,
57625761 elif align != 'edge' :
57635762 raise ValueError , 'invalid align: %s' % align
57645763
5764+ if log :
5765+ y [0 ],y [- 1 ] = 1e-100 , 1e-100
5766+ if orientation == 'horizontal' :
5767+ self .set_xscale ('log' )
5768+ elif orientation == 'vertical' :
5769+ self .set_yscale ('log' )
5770+
57655771 for m in n :
57665772 y [1 :- 1 :2 ], y [2 ::2 ] = m , m
57675773 if orientation == 'horizontal' :
57685774 x ,y = y ,x
57695775 elif orientation != 'vertical' :
57705776 raise ValueError , 'invalid orientation: %s' % orientation
57715777 patches .append ( self .fill (x ,y ) )
5778+
5779+ # adopted from adjust_x/ylim part of the bar method
5780+ if orientation == 'horizontal' :
5781+ xmin , xmax = 0 , self .dataLim .intervalx [1 ]
5782+ for m in n :
5783+ xmin = np .amin (m [m != 0 ]) # filter out the 0 height bins
5784+ xmin = max (xmin * 0.9 , 1e-100 )
5785+ self .dataLim .intervalx = (xmin , xmax )
5786+ elif orientation == 'vertical' :
5787+ ymin , ymax = 0 , self .dataLim .intervaly [1 ]
5788+ for m in n :
5789+ ymin = np .amin (m [m != 0 ]) # filter out the 0 height bins
5790+ ymin = max (ymin * 0.9 , 1e-100 )
5791+ self .dataLim .intervaly = (ymin , ymax )
5792+ self .autoscale_view ()
5793+
57725794 else :
57735795 raise ValueError , 'invalid histtype: %s' % histtype
57745796
0 commit comments