@@ -854,7 +854,6 @@ def set_properties(self, subset=None, **kwargs):
854
854
def _bar_left (s , color , width , base ):
855
855
"""
856
856
The minimum value is aligned at the left of the cell
857
- .. versionadded:: 0.17.1
858
857
859
858
Parameters
860
859
----------
@@ -872,8 +871,7 @@ def _bar_left(s, color, width, base):
872
871
"""
873
872
normed = width * (s - s .min ()) / (s .max () - s .min ())
874
873
zero_normed = width * (0 - s .min ()) / (s .max () - s .min ())
875
- base = 'width: 10em; height: 80%;'
876
- attrs = (base + 'background: linear-gradient(90deg,{c} {w}%, '
874
+ attrs = (base + 'background: linear-gradient(90deg,{c} {w:.1f}%, '
877
875
'transparent 0%)' )
878
876
879
877
return [base if x == 0 else attrs .format (c = color [0 ], w = x )
@@ -885,7 +883,6 @@ def _bar_left(s, color, width, base):
885
883
def _bar_center_zero (s , color , width , base ):
886
884
"""
887
885
Creates a bar chart where the zero is centered in the cell
888
- .. versionadded:: 0.19.2
889
886
890
887
Parameters
891
888
----------
@@ -906,15 +903,15 @@ def _bar_center_zero(s, color, width, base):
906
903
# (50%, centered on zero)
907
904
m = max (abs (s .min ()), abs (s .max ()))
908
905
909
- normed = s * 50 * width / (100 * m )
906
+ normed = s * 50 * width / (100.0 * m )
910
907
911
908
attrs_neg = (base + 'background: linear-gradient(90deg, transparent 0%'
912
- ', transparent {w}%, {c} {w}%, '
909
+ ', transparent {w:.1f }%, {c} {w:.1f }%, '
913
910
'{c} 50%, transparent 50%)' )
914
911
915
912
attrs_pos = (base + 'background: linear-gradient(90deg, transparent 0%'
916
- ', transparent 50%, {c} 50%, {c} {w}%, '
917
- 'transparent {w}%)' )
913
+ ', transparent 50%, {c} 50%, {c} {w:.1f }%, '
914
+ 'transparent {w:.1f }%)' )
918
915
919
916
return [attrs_pos .format (c = color [1 ], w = (50 + x )) if x >= 0
920
917
else attrs_neg .format (c = color [0 ], w = (50 + x ))
@@ -924,7 +921,6 @@ def _bar_center_zero(s, color, width, base):
924
921
def _bar_center_mid (s , color , width , base ):
925
922
"""
926
923
Creates a bar chart where the midpoint is centered in the cell
927
- .. versionadded:: 0.19.2
928
924
929
925
Parameters
930
926
----------
@@ -944,26 +940,26 @@ def _bar_center_mid(s, color, width, base):
944
940
if s .min () >= 0 :
945
941
# In this case, we place the zero at the left, and the max() should
946
942
# be at width
947
- zero = 0
943
+ zero = 0.0
948
944
slope = width / s .max ()
949
945
elif s .max () <= 0 :
950
946
# In this case, we place the zero at the right, and the min()
951
947
# should be at 100-width
952
- zero = 100
948
+ zero = 100.0
953
949
slope = width / - s .min ()
954
950
else :
955
951
slope = width / (s .max () - s .min ())
956
- zero = (100 + width ) / 2 - slope * s .max ()
952
+ zero = (100.0 + width ) / 2.0 - slope * s .max ()
957
953
958
954
normed = zero + slope * s
959
955
960
956
attrs_neg = (base + 'background: linear-gradient(90deg, transparent 0%'
961
- ', transparent {w}%, {c} {w}%, '
962
- '{c} {zero}%, transparent {zero}%)' )
957
+ ', transparent {w:.1f }%, {c} {w:.1f }%, '
958
+ '{c} {zero:.1f }%, transparent {zero:.1f }%)' )
963
959
964
960
attrs_pos = (base + 'background: linear-gradient(90deg, transparent 0%'
965
- ', transparent {zero}%, {c} {zero}%, {c} {w }%, '
966
- 'transparent {w}%)' )
961
+ ', transparent {zero:.1f }%, {c} {zero:.1f }%, '
962
+ '{c} {w:.1f}%, transparent {w:.1f }%)' )
967
963
968
964
return [attrs_pos .format (c = color [1 ], zero = zero , w = x ) if x > zero
969
965
else attrs_neg .format (c = color [0 ], zero = zero , w = x )
0 commit comments