@@ -860,7 +860,6 @@ def set_properties(self, subset=None, **kwargs):
860
860
def _bar_left (s , color , width , base ):
861
861
"""
862
862
The minimum value is aligned at the left of the cell
863
- .. versionadded:: 0.17.1
864
863
865
864
Parameters
866
865
----------
@@ -878,8 +877,7 @@ def _bar_left(s, color, width, base):
878
877
"""
879
878
normed = width * (s - s .min ()) / (s .max () - s .min ())
880
879
zero_normed = width * (0 - s .min ()) / (s .max () - s .min ())
881
- base = 'width: 10em; height: 80%;'
882
- attrs = (base + 'background: linear-gradient(90deg,{c} {w}%, '
880
+ attrs = (base + 'background: linear-gradient(90deg,{c} {w:.1f}%, '
883
881
'transparent 0%)' )
884
882
885
883
return [base if x == 0 else attrs .format (c = color [0 ], w = x )
@@ -891,7 +889,6 @@ def _bar_left(s, color, width, base):
891
889
def _bar_center_zero (s , color , width , base ):
892
890
"""
893
891
Creates a bar chart where the zero is centered in the cell
894
- .. versionadded:: 0.19.2
895
892
896
893
Parameters
897
894
----------
@@ -912,15 +909,15 @@ def _bar_center_zero(s, color, width, base):
912
909
# (50%, centered on zero)
913
910
m = max (abs (s .min ()), abs (s .max ()))
914
911
915
- normed = s * 50 * width / (100 * m )
912
+ normed = s * 50 * width / (100.0 * m )
916
913
917
914
attrs_neg = (base + 'background: linear-gradient(90deg, transparent 0%'
918
- ', transparent {w}%, {c} {w}%, '
915
+ ', transparent {w:.1f }%, {c} {w:.1f }%, '
919
916
'{c} 50%, transparent 50%)' )
920
917
921
918
attrs_pos = (base + 'background: linear-gradient(90deg, transparent 0%'
922
- ', transparent 50%, {c} 50%, {c} {w}%, '
923
- 'transparent {w}%)' )
919
+ ', transparent 50%, {c} 50%, {c} {w:.1f }%, '
920
+ 'transparent {w:.1f }%)' )
924
921
925
922
return [attrs_pos .format (c = color [1 ], w = (50 + x )) if x >= 0
926
923
else attrs_neg .format (c = color [0 ], w = (50 + x ))
@@ -930,7 +927,6 @@ def _bar_center_zero(s, color, width, base):
930
927
def _bar_center_mid (s , color , width , base ):
931
928
"""
932
929
Creates a bar chart where the midpoint is centered in the cell
933
- .. versionadded:: 0.19.2
934
930
935
931
Parameters
936
932
----------
@@ -950,26 +946,26 @@ def _bar_center_mid(s, color, width, base):
950
946
if s .min () >= 0 :
951
947
# In this case, we place the zero at the left, and the max() should
952
948
# be at width
953
- zero = 0
949
+ zero = 0.0
954
950
slope = width / s .max ()
955
951
elif s .max () <= 0 :
956
952
# In this case, we place the zero at the right, and the min()
957
953
# should be at 100-width
958
- zero = 100
954
+ zero = 100.0
959
955
slope = width / - s .min ()
960
956
else :
961
957
slope = width / (s .max () - s .min ())
962
- zero = (100 + width ) / 2 - slope * s .max ()
958
+ zero = (100.0 + width ) / 2.0 - slope * s .max ()
963
959
964
960
normed = zero + slope * s
965
961
966
962
attrs_neg = (base + 'background: linear-gradient(90deg, transparent 0%'
967
- ', transparent {w}%, {c} {w}%, '
968
- '{c} {zero}%, transparent {zero}%)' )
963
+ ', transparent {w:.1f }%, {c} {w:.1f }%, '
964
+ '{c} {zero:.1f }%, transparent {zero:.1f }%)' )
969
965
970
966
attrs_pos = (base + 'background: linear-gradient(90deg, transparent 0%'
971
- ', transparent {zero}%, {c} {zero}%, {c} {w }%, '
972
- 'transparent {w}%)' )
967
+ ', transparent {zero:.1f }%, {c} {zero:.1f }%, '
968
+ '{c} {w:.1f}%, transparent {w:.1f }%)' )
973
969
974
970
return [attrs_pos .format (c = color [1 ], zero = zero , w = x ) if x > zero
975
971
else attrs_neg .format (c = color [0 ], zero = zero , w = x )
0 commit comments