DuplicateLabelError(label)
Source¶
Bases: NumdaplotError
Raised when two slices of a PieChart have the same label, which could not tell them apart.
Added in version 0.1.0
Parameters:
-
label(str)The repeated label.
Attributes:
-
labelThe repeated label.
Examples:
import numdaplot as ndp
cities = ndp.Array.from_list(["Paris", "Paris"])
sales = ndp.Array.from_list([120.0, 80.0])
shares = ndp.Table.from_arrays({"city": cities, "sales": sales})
chart = ndp.PieChart(labels="city", values="sales")
try:
ndp.Plot.pie(shares, chart)
except ndp.DuplicateLabelError as error:
print(error)
# The label 'Paris' appears more than once.