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
Thanks for matplotlib! tripcolor fails if colors are passed with named argument i.e c=values instead of just values. The error is not very informative and it seems a dangerous practice to ignore kwargs and only use args.
File "/mnt/session_space/conda_envs/latest39/lib/python3.9/site-packages/matplotlib/tri/tripcolor.py", line 57, in tripcolor
C = np.asarray(args[0])
IndexError: list index out of range
File "/mnt/session_space/conda_envs/latest39/lib/python3.9/site-packages/matplotlib/tri/tripcolor.py", line 57, in tripcolor
C = np.asarray(args[0])
IndexError: list index out of range
Basically tripcolor(np.random.rand(5), np.random.rand(5), C=np.random.rand(5)) currently fails with the not-so-informative error message above (the correct invocation is tripcolor(np.random.rand(5), np.random.rand(5), np.random.rand(5))). I think we should indeed not allow passing C by keyword, only positionally (see #11526 for essentially the same discussion on quiver); however the error could be made clearer.
Reacted by Jody Klymak, Tim Hoffmann and ThibaultGROUEIX
Unfortunately, the API is heavily overloaded. We need an *args parameter that can take many forms, and we cannot get rid of it without major API breakage. Things to do:
Clarify which APIs we want to support
Improve the documentation
Cleanup the parameter parsing. There seem some assumptions to be baked in. Probably we should have an internal parser function triangulation, C, kwargs = parse_params(args, kwargs) that we can unittest the defined API against, and that issues reasonable warnings.
Activity
QuLogic commentedon Jan 25, 2022
Please provide a complete example. (Also, I don't think
cis a valid keyword argument totripcolor.)jklymak commentedon Jan 28, 2022
I'll close for lack of response, but do request a re-open if there is still an issue here.
anntzer commentedon Jan 28, 2022
Basically
tripcolor(np.random.rand(5), np.random.rand(5), C=np.random.rand(5))currently fails with the not-so-informative error message above (the correct invocation istripcolor(np.random.rand(5), np.random.rand(5), np.random.rand(5))). I think we should indeed not allow passing C by keyword, only positionally (see #11526 for essentially the same discussion on quiver); however the error could be made clearer.timhoffm commentedon Jan 28, 2022
Unfortunately, the API is heavily overloaded. We need an
*argsparameter that can take many forms, and we cannot get rid of it without major API breakage. Things to do:triangulation, C, kwargs = parse_params(args, kwargs)that we can unittest the defined API against, and that issues reasonable warnings.