File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2070,10 +2070,9 @@ def make_iterable(x):
20702070
20712071 if align == 'center' :
20722072 if orientation == 'vertical' :
2073- left = [left [ i ] - width [ i ] / 2. for i in xrange ( len ( left ) )]
2073+ left = [l - w / 2. for l , w in zip ( left , width )]
20742074 elif orientation == 'horizontal' :
2075- bottom = [bottom [i ] - height [i ] / 2.
2076- for i in xrange (len (bottom ))]
2075+ bottom = [b - h / 2. for b , h in zip (bottom , height )]
20772076
20782077 elif align != 'edge' :
20792078 raise ValueError ('invalid alignment: %s' % align )
Original file line number Diff line number Diff line change @@ -4863,6 +4863,36 @@ def test_pandas_indexing_hist():
48634863 axes .hist (ser_2 )
48644864
48654865
4866+ def test_pandas_bar_align_center ():
4867+ # Tests fix for issue 8767
4868+ pd = pytest .importorskip ('pandas' )
4869+
4870+ df = pd .DataFrame ({'a' : range (2 ), 'b' : range (2 )})
4871+
4872+ fig , ax = plt .subplots (1 )
4873+
4874+ rect = ax .bar (df .loc [df ['a' ] == 1 , 'b' ],
4875+ df .loc [df ['a' ] == 1 , 'b' ],
4876+ align = 'center' )
4877+
4878+ fig .canvas .draw ()
4879+
4880+
4881+ def test_pandas_bar_align_center ():
4882+ # Tests fix for issue 8767
4883+ pd = pytest .importorskip ('pandas' )
4884+
4885+ df = pd .DataFrame ({'a' : range (2 ), 'b' : range (2 )})
4886+
4887+ fig , ax = plt .subplots (1 )
4888+
4889+ rect = ax .barh (df .loc [df ['a' ] == 1 , 'b' ],
4890+ df .loc [df ['a' ] == 1 , 'b' ],
4891+ align = 'center' )
4892+
4893+ fig .canvas .draw ()
4894+
4895+
48664896def test_axis_set_tick_params_labelsize_labelcolor ():
48674897 # Tests fix for issue 4346
48684898 axis_1 = plt .subplot ()
You can’t perform that action at this time.
0 commit comments