Closed
Description
Problem
I often find myself using an equivalent of this code:
x = np.linspace(x_min, x_max)
pyplot.plot(x, f(x))
This is unnecessarily verbose, and if written in one line has redundancy:
pyplot.plot(np.linspace(x_min, x_max), f(np.linspace(x_min, x_max)))
Proposed solution
It would be convenient if .plot
and similar high level plotting routines identified callable arguments and if possible evaluated those with array arguments. I imagine the amount of meaningful combinations would be limited.
Additional context and prior art
Providing functions as input to plotting routines and letting those take care of the evaluation is a common pattern.
- Julia has such interface
- Mathematica goes a step further and determines how to sample the function. This is out of scope for matplotlib.
- Similarly matlab has fplot