Skip to content

InvalidColorCountError(color_count, series_count) Source

Bases: NumdaplotError

Raised when the colors of a chart are not exactly one per series.

Added in version 0.1.0

Parameters:

  • color_count (int)

    The number of colors given.

  • series_count (int)

    The number of series drawn.

Attributes:

  • color_count

    The number of colors given.

  • series_count

    The number of series drawn.

Examples:

import numdaplot as ndp

days = ndp.Array.from_list([1, 2])
prices = ndp.Array.from_list([12.0, 15.5])
costs = ndp.Array.from_list([8.0, 9.0])
sales = ndp.Table.from_arrays({"day": days, "price": prices, "cost": costs})
chart = ndp.LineChart(x="day", y=["price", "cost"], colors=[ndp.Color.BLUE])
try:
    ndp.Plot.line(sales, chart)
except ndp.InvalidColorCountError as error:
    print(error)
# Expected one color per series, 2 series and 1 color(s) given.