from_function#
- classmethod DataXY.from_function(f, x, title='', xlabel='', ylabel='', **fkwargs)[source]#
Instantiate from a function.
- Parameters:
- fCallable
y-data will be f(x, **fkwargs).
- xarray_like
x-points at which f will be evaluated.
- title
str, default “” Optional title of the data.
- xlabel
str, default “” Optional x-label of the data.
- ylabel
str, default “” Optional y-label of the data.
- **fkwargs
Other keyword arguments will be passed to f.
- Returns:
Examples
>>> data = ap.DataXY.from_function(lambda x : x**2, (0, 1, 2)) >>> data.x array([0., 1., 2.]) >>> data.y array([0., 1., 4.])