graphinglib.SmartFigureWCS.add_elements#
- SmartFigureWCS.add_elements(*elements: Plottable | SmartFigure | None | Iterable[Plottable | None]) Self#
Adds one or more
Plottableobjects to the current SmartFigure.If the SmartFigure is used as a single plot, the elements are appended to that plot. If the SmartFigure is used as a layout, the elements are applied to the grid from left to right, then top to bottom. Existing child plots are appended to, and empty positions are filled by creating new child plots as needed. This method is equivalent to using the
__setitem__()method for single cells, but can only add elements spanning single subplots.- Parameters:
- elementsPlottable | Iterable[Plottable]
Elements to plot in the
SmartFigure. Iterables ofPlottableobjects can be provided to add multiple elements to the same plot. If the SmartFigure is used as a single plot, all provided elements are added to that plot. If the SmartFigure is used as a layout, the given elements are applied to the grid from left to right, then top to bottom. Existing child plots are appended to, and empty positions are filled by creating new child plots as needed. IfNoneelements are present, the corresponding target is skipped.Note
This method can create new 1x1 child plots when filling an existing layout, but it does not create multi-cell spans. If you want to add elements that span multiple subplots, you should use the
__setitem__()method instead.
- Returns:
- Self
For convenience, the same
SmartFigurewith the added elements.
See also
__setitem__()For more information on how to use the
__setitem__method to add elements that span multiple columns or rows to theSmartFigure.