Skip to content

Percentages Source

Bases: Enum

Whether the slices of a PieChart show their share of the total.

Added in version 0.1.0

Examples:

import numdaplot as ndp

cities = ndp.Array.from_list(["Paris", "Lyon", "Pau"])
sales = ndp.Array.from_list([120.0, 80.0, 45.0])
shares = ndp.Table.from_arrays({"city": cities, "sales": sales})
chart = ndp.PieChart(labels="city", values="sales", percentages=ndp.Percentages.HIDDEN)
plot = ndp.Plot.pie(shares, chart)
plot.show()

Plot drawn by the example

Attributes

SHOWN = auto() Source

Each slice shows its share with one decimal, such as 42.5%. Default value.

Added in version 0.1.0

Examples:

import numdaplot as ndp

cities = ndp.Array.from_list(["Paris", "Lyon", "Pau"])
sales = ndp.Array.from_list([120.0, 80.0, 45.0])
shares = ndp.Table.from_arrays({"city": cities, "sales": sales})
chart = ndp.PieChart(labels="city", values="sales", percentages=ndp.Percentages.SHOWN)
plot = ndp.Plot.pie(shares, chart)
plot.show()

Plot drawn by the example

HIDDEN = auto() Source

The slices only show their label.

Added in version 0.1.0

Examples:

import numdaplot as ndp

cities = ndp.Array.from_list(["Paris", "Lyon", "Pau"])
sales = ndp.Array.from_list([120.0, 80.0, 45.0])
shares = ndp.Table.from_arrays({"city": cities, "sales": sales})
chart = ndp.PieChart(labels="city", values="sales", percentages=ndp.Percentages.HIDDEN)
plot = ndp.Plot.pie(shares, chart)
plot.show()

Plot drawn by the example