Cell(row, column, row_span=1, column_span=1)
Source¶
Place of a Plot in the grid of a Figure: its first cell, and how many cells it spans.
Rows and columns are numbered from 0, row 0 at the top and column 0 on the left.
Added in version 0.1.0
Parameters:
-
row(int)The row of the top cell, from 0.
-
column(int)The column of the left cell, from 0.
-
row_span(int, default:1)The number of rows covered, 1 by default.
-
column_span(int, default:1)The number of columns covered, 1 by default.
Raises:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
-
InvalidPositionErrorWhen
roworcolumnis lower than 0. -
InvalidCountErrorWhen
row_spanorcolumn_spanis lower than 1.
Examples:
import numdaplot as ndp
months = ndp.Array.from_list([1, 2, 3, 4, 5, 6])
sales = ndp.Array.from_list([120.0, 150.0, 90.0, 170.0, 160.0, 185.0])
costs = ndp.Array.from_list([80.0, 95.0, 70.0, 110.0, 100.0, 120.0])
shop = ndp.Table.from_arrays({"month": months, "sales": sales, "cost": costs})
trend = ndp.Plot.line(shop, ndp.LineChart(x="month", y=["sales", "cost"]))
sales_spread = ndp.Plot.box(shop, ndp.BoxChart(columns=["sales"]))
cost_spread = ndp.Plot.box(shop, ndp.BoxChart(columns=["cost"]))
figure = ndp.Figure(ndp.Layout(rows=2, columns=2))
figure = figure.place(trend, ndp.Cell(row=0, column=0, column_span=2))
figure = figure.place(sales_spread, ndp.Cell(row=1, column=0))
figure = figure.place(cost_spread, ndp.Cell(row=1, column=1))
figure.show()