You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Noted as part of #3907, the inputs on pivot for quiver is very permissive and will take 'mid' or 'middle', however it will also work with out exception with any string input (by just silently falling back to 'tail'):
X, Y=np.meshgrid(np.linspace(-np.pi, np.pi, 16), np.linspace(-np.pi, np.pi, 16))
v=np.sin(X)
u=np.cos(Y)
plt.quiver(X, Y, u, v)
plt.quiver(X, Y, u, v, color='b', pivot='ardvaark', alpha=.5)
I propose that a) we validate the input to be in {'tip', 'tail', 'mid', 'middle'} and accept but warn anything else down to tail for one version before raising.
The present situation is the result of my minimalist approach when I wrote it. In the history of mpl, strict validation of inputs has been inconsistent, to say the least.
For 1.5, I think that your proposed "accept but warn" is overkill; do we really need to warn every time we tighten the validation a bit to match the longstanding documentation and reasonable expectations? It's a question of a tradeoff between safety on one side and effort/clutter on the other. I think that in this case, it is OK to keep it simple: add the validation and note it in the changelog. No warning, no test.
Activity
efiring commentedon Dec 28, 2014
The present situation is the result of my minimalist approach when I wrote it. In the history of mpl, strict validation of inputs has been inconsistent, to say the least.
For 1.5, I think that your proposed "accept but warn" is overkill; do we really need to warn every time we tighten the validation a bit to match the longstanding documentation and reasonable expectations? It's a question of a tradeoff between safety on one side and effort/clutter on the other. I think that in this case, it is OK to keep it simple: add the validation and note it in the changelog. No warning, no test.
tacaswell commentedon Dec 28, 2014
Fair enough.
This is all sort of balled up with how we auto-fleshout the docstrings as well.
I am working on a proposal to piggy back on the mechanism that function annotations use in pythen3 (http://python-future.org/func_annotations.html) to put the information used for validation and for building the docstrings in exactly one place (and my working on I need to figure out if it will work).
API : tighten validation on pivot in Quiver
API : tighten validation on pivot in Quiver
Fixed issue with connection_flows=True in slice_plot()/layer_plot() c…