Skip to content

BarLayout Source

Bases: Enum

How the bars of several series share a position of a BarChart.

Added in version 0.1.0

Examples:

import numdaplot as ndp

days = ndp.Array.from_list([1, 2, 3, 4])
prices = ndp.Array.from_list([12.0, 15.5, 14.0, 17.0])
costs = ndp.Array.from_list([8.0, 9.5, 9.0, 10.0])
sales = ndp.Table.from_arrays({"day": days, "price": prices, "cost": costs})
chart = ndp.BarChart(x="day", y=["price", "cost"], layout=ndp.BarLayout.STACKED)
plot = ndp.Plot.bar(sales, chart)
plot.show()

Plot drawn by the example

Attributes

GROUPED = auto() Source

Side by side. Default value.

Added in version 0.1.0

Examples:

import numdaplot as ndp

days = ndp.Array.from_list([1, 2, 3, 4])
prices = ndp.Array.from_list([12.0, 15.5, 14.0, 17.0])
costs = ndp.Array.from_list([8.0, 9.5, 9.0, 10.0])
sales = ndp.Table.from_arrays({"day": days, "price": prices, "cost": costs})
chart = ndp.BarChart(x="day", y=["price", "cost"], layout=ndp.BarLayout.GROUPED)
plot = ndp.Plot.bar(sales, chart)
plot.show()

Plot drawn by the example

STACKED = auto() Source

On top of each other, positive values above zero and negative values below it.

Added in version 0.1.0

Examples:

import numdaplot as ndp

days = ndp.Array.from_list([1, 2, 3, 4])
prices = ndp.Array.from_list([12.0, 15.5, 14.0, 17.0])
costs = ndp.Array.from_list([8.0, 9.5, 9.0, 10.0])
sales = ndp.Table.from_arrays({"day": days, "price": prices, "cost": costs})
chart = ndp.BarChart(x="day", y=["price", "cost"], layout=ndp.BarLayout.STACKED)
plot = ndp.Plot.bar(sales, chart)
plot.show()

Plot drawn by the example