[Matplotlib-devel] Suggestion: accept callables as non-xs values arguments

Andy Buckley andy.buckley at cern.ch
Thu Sep 17 22:33:11 CEST 2015


Not sure if this is the best place to post this, but I have an API 
suggestion: as well as iterables, mpl plotting functions could accept 
callable objects to generate y values, errors, etc..

Specifically, I'm thinking that the list of x values would always need 
to be specified as an iterable like now, but that the other arguments 
which currently require an iterable of the same length as the xs could 
alternatively accept callables that are mapped on to the xs list. The 
presence of __iter__ or __call__ attributes could be used to determine 
which approach to use.

I searched a bit and couldn't find any previous mention of this idea, 
and there are callable arguments already used in matplotlib. Thoughts? 
I'd be happy to help with implementation if there is any interest.

Best wishes,

More information about the Matplotlib-devel mailing list