toyplot.broadcast module¶
Functions for broadcasting values into 1D or 2D arrays.
The functions in this module are used by Toyplot to handle the conversion from constant, per-series, and per-datum values into their canonical 1D and 2D array representations.
-
toyplot.broadcast.
pyobject
(value, shape)[source]¶ Return a 1D or 2D array of objects with the given shape.
Parameters: shape ((tuple)) – Shape of the desired output array. A 1-tuple will produce a 1D output vector containing \(N\) per-series values. A 2-tuple will produce an \(M \times N\) output matrix of per-datum values grouped into \(N\) series. Returns: array Return type: numpy.ndarray
-
toyplot.broadcast.
scalar
(value, shape)[source]¶ Return a 1D or 2D array of floats with the given shape.
Parameters: shape ((tuple)) – Shape of the desired output array. A 1-tuple will produce a 1D output vector containing \(N\) per-series values. A 2-tuple will produce an \(M \times N\) output matrix of per-datum values grouped into \(N\) series. Returns: array Return type: numpy.ndarray