Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 68f91d5

Browse files
committed
Basic changes
1 parent 0520035 commit 68f91d5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/matplotlib/sankey.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,14 @@ def _get_angle(a, r):
739739
if label is None or angle is None:
740740
label = ''
741741
elif self.unit is not None:
742-
quantity = self.format % abs(number) + self.unit
742+
if self.format is None:
743+
self.format = '%G'
744+
if isinstance(self.format, str):
745+
quantity = self.format % abs(number) + self.unit
746+
elif callable(self.format):
747+
quantity = self.format(100. * abs(number))
748+
else:
749+
raise TypeError('format must be callable or a format string')
743750
if label != '':
744751
label += "\n"
745752
label += quantity

0 commit comments

Comments
 (0)