I was looking at the Axes code. In particular I think of implementing a
Axes.lines method, which would unify Axes.hlines and Axes.vlines, reducing the
required code maintenance. I have also studied the code of these two methods,
and I have now several questions/remarks.
* hlines(y=iter(xrange(5), ...) is declared to work, since
"*y*: a 1-D numpy array or iterable." However, this will produce an error in
the end, because y ends up passed to a np.asarray, instead of np.fromiter.
This bug is easy to fix, however I would like to know what is the desired
overall behavior of the function, see the following.
* These two functions are designed to pass arguments to
collections.LineCollection, which actually is ok with taking an iterable as
argument, however these functions forms first a numpy array, then a list of
tuples. The allowed arguments to these functions, in the meantime aren't even
homogeneous: some are required to be scalars or iterators, some scalars or
* Scalars are interpreted as constant iterators. Would it be also a reasonable
behavior to interpret shorter iterators as cycles, or should only scalars be
allowed as special values?
* When checking for scalars is there a reason to favor cbook.scalar, which uses
a crude method over np.isscalar, which is presumably more thorough?
* A somewhat related question: unit converter interface specifies that it
work on sequences (objects which have length and many other extra
At the same time, unit conversion in several parts of code is applied to
objects which are allowed to be just iterators. Should unit conversion
actually also work on iterators, or should matplotlib not take anywhere where
unit conversion is used? By the way, units.ConversionInterface could benefit
from using python abc abstract base classes module. Does it make sense to
* Finally, does it make sense to combine hlines and vlines?