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
My first time using this library and just by chance I managed to run into a weird edge case in the first few minutes:
Bug summary
If you use a variable name in your target function, that is also declared in the pyplot.interactive_plot function, it'll throw a confusing TypeError due to the name collision. For me it was declaring a variable named xlim.
Code for reproduction
Using the Basic example from the doc's, but changing the declared variable name in the user defined function f to trigger a name collision:
The exception thrown is confusing as it classifies xlim as a missing positional argument, when the user supplied it as a keyword argument.
Expected outcome
The code should work without throwing an exception, exactly as in the documentation.
Some ideas for a fix:
prefix all the variables declared in interactive_plot with a _.: e.g. _xlim
Add a validation step to check for name collisions and throw a helpful exception if found. e.g. '_xlim is a reserved name, please change your argument name in function f' or similar.
Bug report
My first time using this library and just by chance I managed to run into a weird edge case in the first few minutes:
Bug summary
If you use a variable name in your target function, that is also declared in the
pyplot.interactive_plot
function, it'll throw a confusingTypeError
due to the name collision. For me it was declaring a variable namedxlim
.Code for reproduction
Using the Basic example from the doc's, but changing the declared variable name in the user defined function
f
to trigger a name collision:Actual outcome
The exception thrown is confusing as it classifies
xlim
as a missing positional argument, when the user supplied it as a keyword argument.Expected outcome
The code should work without throwing an exception, exactly as in the documentation.
Some ideas for a fix:
interactive_plot
with a_
.: e.g._xlim
_xlim
is a reserved name, please change your argument name in functionf
' or similar.Thanks for your work, it's a helpful package.
Version Info
print(matplotlib.get_backend())
): ipympl.backend_nbaggThe text was updated successfully, but these errors were encountered: