-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: eventplot 'colors' kwarg (#8193) #8204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lib/matplotlib/axes/_axes.py
Outdated
Plot parallel lines at the given positions. positions should be a 1D | ||
or 2D array-like object, with each row corresponding to a row or column | ||
of lines. | ||
Plot identical parallel lines at the given positions. positions should |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep a single summary line.
Mark arguments as *such*
. (See "documenting matplotlib" entry in the faq.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I did not forget any utterance, it should be OK now with c3d7e8d.
lib/matplotlib/axes/_axes.py
Outdated
|
||
This type of plot is commonly used in neuroscience for representing | ||
neural events, where it is commonly called a spike raster, dot raster, | ||
neural events, where it is usually called a spike raster, dot raster, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"commonly" looks more idiomatic but I am not a native speaker either...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe some English guru as @QuLogic might be able to enlighten us about this :). (I was just trying to avoid a repetition with the line just above.)
lib/matplotlib/axes/_axes.py
Outdated
'horizontal' : the lines will be vertical and arranged in rows | ||
'vertical' : lines will be horizontal and arranged in columns | ||
Parameters | ||
========== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use dashes (-
) for underlining.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should now be OK.
lib/matplotlib/axes/_axes.py
Outdated
linestyles : str or tuple or a sequence of such values, optional. | ||
Default is 'solid'. Valid strings are [ 'solid' | 'dashed' | | ||
'dashdot' | 'dotted' | '-' | '--' | '-.' | ':' ]. Dash tuples | ||
have to follow:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"have to be of the form"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by fc212ee.
lib/matplotlib/collections.py
Outdated
a sequence of numerical values or a 1D numpy array. Can be None | ||
Parameters | ||
---------- | ||
positions : 1D array-like object or None. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the previous implementation did not support passing None as input (despite being documented that it does). If that is correct I would fix the docstring to say it's not supported (I don't see why it should).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going into the other direction :/ (based on the fact that LineCollection
accepts None
). Your suggestion may be better actually:
- changing the docstring is some kind of API break but as it was raising an error anyway…
- accepting
None
is not without some side-effects oneventplot
, which I tried to mitigate by makingeventplot(None)
equivalent toeventplot([])
, but on second thought the API break may even be worse than the previous solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it was not working before it's not really an API break...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right, I will revert my changes toward your idea of just fixing the docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (reverted my changes and instead simply fixed the relevant docstring) by fc212ee.
lib/matplotlib/collections.py
Outdated
linestyle : str or tuple, optional. Default is 'solid'. | ||
If it is a string, it has to be among [ 'solid' | 'dashed' | | ||
'dashdot' | 'dotted' | '-' | '--' | '-.' | ':' ]. If it is a dash | ||
tuple, it has to be of the form:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by fc212ee.
lib/matplotlib/collections.py
Outdated
raise ValueError('if positions is an ndarry it cannot have ' | ||
'dimensionality great than 1 ') | ||
raise ValueError('if positions is an ndarray it cannot have ' | ||
'dimensionality strictly greater than 1 ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"greater than 1" (In English, greater = "strictly greater").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! I did not know that 🐑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://en.wikipedia.org/wiki/Inequality_(mathematics)
https://en.wikipedia.org/wiki/Sign_(mathematics)#non-negative_and_non-positive
"Because zero is neither positive nor negative (in most countries)" I guess we just like being different in France...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by fc212ee.
|
||
.. plot:: mpl_examples/pylab_examples/eventcollection_demo.py | ||
""" | ||
|
||
segment = (lineoffset + linelength / 2., | ||
lineoffset - linelength / 2.) | ||
if len(positions) == 0: | ||
if positions is None or len(positions) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would just write positions = np.asarray(positions)
(or np.atleast_1d(positions)
if we want to support scalars)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and then you know for sure it has an ndim attribute)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring does not say that one should expect scalars to be supported, and the other collections classes does not seem to support it either. So I would say => np.asarray
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now using positions = np.asarray(positions)
since fc212ee.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted on a @tacaswell's comment.
lib/matplotlib/collections.py
Outdated
raise ValueError('if positions is an ndarry it cannot have ' | ||
'dimensionality great than 1 ') | ||
raise ValueError('if positions is an ndarray it cannot have ' | ||
'dimensionality strictly greater than 1 ') | ||
elif (orientation is None or orientation.lower() == 'none' or | ||
orientation.lower() == 'horizontal'): | ||
positions.sort() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to sort the positions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not totally understand how it works, be it looks like it is needed by how the “offsets” are handled in LineCollection
. In particular, the _add_offsets
seems to be sensitive to the ordering of the segments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the fun I tried to not sorting the positions: the tests do not pass anymore. So I would be inclined to conclude that indeed we need to sort the positions ^^…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got a couple of minor comments, and one major comment: we decided a while back to drop docstring interpolation. Can you remove it and add a reference to the line collection arguments instead?
Else, it looks good.
Plot parallel lines at the given positions. positions should be a 1D | ||
or 2D array-like object, with each row corresponding to a row or column | ||
of lines. | ||
*positions* should be a 1D or 2D array-like object, with each row |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we had a consensus to drop the "*".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion starting here: #8172 (comment)
ref http://matplotlib.org/devdocs/devel/documenting_mpl.html#formatting
ref https://docs.python.org/devguide/documenting.html#id3
Let's keep the asterisks unless there is agreement to switch to double backquotes (which I would not favor). If we go with such a switch the documenting matplotlib guide should be updated first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently still using *
. I will change it if a consensus emerges that it is not the proper markup to use (i.e. if the dev guidelines are updated :) ).
lib/matplotlib/collections.py
Outdated
an axis, such as time or length. Events do not have an amplitude. They | ||
are displayed as v | ||
The events are a 1-dimensional array, usually the position of something | ||
along an axis, such as time or length. The do not have an amplitude and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a small typo: The -> They
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by 6713a76.
Edit: Fixed the reference to the commit…
lib/matplotlib/collections.py
Outdated
:attr:`~matplotlib.cm.ScalarMappable._A` is not None (i.e., a call to | ||
:meth:`~matplotlib.cm.ScalarMappable.set_array` has been made), at | ||
draw time a call to scalar mappable will be made to set the colors. | ||
%(LineCollection)s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not use string interpolation in docstring anymore. This line should be removed and replace with a reference to the line collection arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NelleV From a quick look at pyplot.py
, there are several ways of refering to additional kwargs. What would you prefer between
The keyword arguments *kwargs*, if any, are
:class:`~matplotlib.collections.LineCollection` properties.
and
kwargs : optional
Other keyword arguments are line collection properties. See
:class:`~matplotlib.collections.LineCollection` for a list of
the valid properties.
? For the latter, I would move it at the end of the parameter list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6713a76 replaces it with the second solution that I mentioned. If it is too verbose, I could change it for the first proposition and squash/rebase the commits.
Edit: Fixed the reference to the commit…
@NelleV I just saw your comments. I cannot address them right now but I will address them ASAP :). |
@NelleV and @anntzer thank you both for the previous reviews. Most of your comments should have been adressed with the last two commits (fc212ee and 6713a76). The ones that haven't been fixed are the ones on which you do not agree both ^^, or that were more a question than a fix to perform. Edit: typos… |
lib/matplotlib/collections.py
Outdated
|
||
.. plot:: mpl_examples/pylab_examples/eventcollection_demo.py | ||
""" | ||
|
||
segment = (lineoffset + linelength / 2., | ||
lineoffset - linelength / 2.) | ||
positions = np.asarray(positions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can strip off unit information, can you remove this set of changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't cast to array to avoid breaking unit handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring stuff.
lib/matplotlib/axes/_axes.py
Outdated
'vertical' : lines will be horizontal and arranged in columns | ||
Parameters | ||
---------- | ||
positions : 1D or 2D array-like object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type doesn't require trailing punctuation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I did not forget any, I removed trailing punctuation for all the paramater entries.
lib/matplotlib/axes/_axes.py
Outdated
|
||
*lineoffsets* : | ||
A float or array-like containing floats. | ||
orientation : str [ 'horizontal' (default) | 'vertical' ], optional. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orientation : {'horizontal', 'vertical'}, optional
is the way to specify a choice of values with numpydoc (the first value is the default.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
lib/matplotlib/axes/_axes.py
Outdated
*lineoffsets* : | ||
A float or array-like containing floats. | ||
orientation : str [ 'horizontal' (default) | 'vertical' ], optional. | ||
'horizontal' : the lines will be vertical and arranged in rows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusing because it says horizontal is vertical and vertical is horizontal. I would swap the order of the descriptions so that things that are the same come next to each other, i.e., 'horizontal': the lines are arranged horizontally in rows, and are vertical.
Also, these are not bullet points or separate paragraphs, so keep that in mind; both lines will appear as one paragraph in the rendered docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I agree it was confusing (I was surprised too the first time I read it…). So, changed accordingly to your suggestion. And the 2 values should now be displayed as a 2-entry bullet list.
lib/matplotlib/axes/_axes.py
Outdated
A float or array-like containing floats. | ||
linelengths : scalar or sequence of scalars, optional. Default is 1. | ||
The total height of the lines (i.e. the lines stretches from | ||
``lineoffset + linelength/2`` to ``lineoffset - linelength/2``). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Negative before positive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
lib/matplotlib/axes/_axes.py
Outdated
must be a sequence of RGBA tuples (e.g., arbitrary color | ||
strings, etc, not allowed) or a list of such sequences | ||
linewidths : scalar, scalar sequence or None, optional. Default: None. | ||
If it is None, defaults to its rcParams setting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not actually a description of what it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree but it was like this before, so I did wanted to change it. I added a sentence (that may be obvious though):
The line width(s) of the event lines, in points.
I also added something similar for the colors parameter entry just after.
lib/matplotlib/collections.py
Outdated
a single numerical value | ||
linelength : scalar, optional. Default is 1. | ||
The total height of the marker (i.e. the marker stretches from | ||
``lineoffset + linelength/2`` to ``lineoffset - linelength/2``). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Negative to positive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
lib/matplotlib/collections.py
Outdated
1 or 2 | ||
linestyle : str or tuple, optional. Default is 'solid'. | ||
Valid strings are [ 'solid' | 'dashed' | 'dashdot' | 'dotted' | | ||
'-' | '--' | '-.' | ':' ]. Dash tuples have to be of the form:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make this a list instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@QuLogic I am not sure I understand what you mean. You would write something like:
linestyle : str or tuple, optional. Default is 'solid'.
Valid strings are ['solid', 'dashed', 'dashdot', 'dotted',
'-', '--', '-.', ':']. Dash tuples should be of the form::
or
linestyle : ['solid', 'dashed', 'dashdot', 'dotted', '-', '--', '-.',
':', tuple], optional
Dash tuples should be of the form::
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The former.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thanks! Done (in _axes.eventplot
too).
lib/matplotlib/collections.py
Outdated
|
||
*pickradius* is the tolerance for mouse clicks picking a line. | ||
The default is 5 pt. | ||
antialiased : [None (default) | 1 | 2], optional. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{None, 1, 2}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
lib/matplotlib/collections.py
Outdated
:attr:`~matplotlib.cm.ScalarMappable._A` is not None (i.e., a call to | ||
:meth:`~matplotlib.cm.ScalarMappable.set_array` has been made), at | ||
draw time a call to scalar mappable will be made to set the colors. | ||
kwargs : optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**kwargs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
lib/matplotlib/axes/_axes.py
Outdated
*linelengths* : | ||
A float or array-like containing floats. | ||
lineoffsets : scalar or sequence of scalars, optional. Default is 1. | ||
The offset of the center of the lines from the origin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs a clarification of which way. If it's horizontal, then is it an offset horizontally or vertically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to make the statement a bit more precise:
The offset of the center of the lines from the origin, in the
orthogonal direction to *orientation*.
6713a76
to
e70e5fd
Compare
The comments made by @QuLogic and @tacaswell should now have been adressed :). I had to rebase to be able to build the docs under Python 2.7 (my branch was done before the recent fix that made docs to build again with 2.7…). Being there, I squashed some tiny commits. I think there is still (at least) one question: “In the present case, to test (only) the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you could write it in a way that doesn't require an image, that's probably better since it'll save on space and I/O and stuff.
lib/matplotlib/axes/_axes.py
Outdated
A float or array-like containing floats. | ||
lineoffsets : scalar or sequence of scalars, optional, default: 1 | ||
The offset of the center of the lines from the origin, in the | ||
orthogonal direction to *orientation*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orthogonal direction -> direction orthogonal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
lib/matplotlib/collections.py
Outdated
lineoffset-linelength/2). Defaults to 1 | ||
lineoffset : scalar, optional, default: 0 | ||
The offset of the center of the markers from the origin, in the | ||
orthogonal direction to *orientation*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orthogonal direction -> direction orthogonal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
lib/matplotlib/tests/test_axes.py
Outdated
axs[1, 1].eventplot(data, colors='rgbk') | ||
|
||
for ax in axs.flat: | ||
ax.set_xlim(-0.1, 3.1) # avoid having some events on the axes edges |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could pass style='default'
and then get automatic margins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I switched for a non-picture test ;)
Ok, normally the new test should be equivalent to the previous one, but is not based on |
Of course there are some PEP8 issues… And I wanted to make @anntzer happy with |
cbdec92
to
93d9e2e
Compare
Fixed the PEP8 issue and now use the Re-rebased, and squashed everything into 3 (more or less) self-contained commits. Doing this, the picture test and the associated PNG file were removed, as well as the unfortunate idea of casting everything to np.array on @tacaswell's demand (subtle hidden ping ^^). Fingers crossed that Travis will be happy this time (at least locally, tests seem to be ok and the docs can be built). |
lib/matplotlib/axes/_axes.py
Outdated
For *linelengths*, *linewidths*, *colors*, and *linestyles*, if only | ||
a single value is given, that value is applied to all lines. If an | ||
array-like is given, it must have the same length as *positions*, and | ||
each value will be applied to the corresponding row or column of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just say "row of the array" to avoid this ambiguous conjunction (IIUC, it's always the row of the array.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @QuLogic . I changed the phrasing as you suggested (if I understood correctly what you were saying):
For *linelengths*, *linewidths*, *colors*, and *linestyles*, if only
a single value is given, that value is applied to all lines. If an
array-like is given, it must have the same length as *positions*, and
each row of the array will be applied to the corresponding row or
column of events.
and then rebased and squashed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I was actually referring to the events at the end of the sentence. There isn't any row of the linelengths/linewidths/colors/linestyles because they're all 1D.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed… It seems that I was I was tired this morning and I mixed this arrays with positions in my head ^^. Sorry, I will fix it ASAP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully it is now fixed as you suggested by c0c6bc9 ^^.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that looks about right.
…consistent with its behavior)
93d9e2e
to
c49a4c8
Compare
@anntzer @tacaswell can you review this patch again? |
lib/matplotlib/collections.py
Outdated
raise ValueError('if positions is an ndarry it cannot have ' | ||
'dimensionality great than 1 ') | ||
raise ValueError('positions cannot have a dimensionality greater ' | ||
'than 1 (in the ndarray sense)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot be an array with more than one dimension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (c0c6bc9).
*pickradius* is the tolerance for mouse clicks picking a line. | ||
The default is 5 pt. | ||
antialiased : {None, 1, 2}, optional | ||
If it is None, defaults to its rcParams setting, in sequence form. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can antialiased really be a sequence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I have no idea of what this parameter is doing except that it has to do with AA. So I tried to avoid changing the original sentence as much as possible.
From a very quick look at other docstrings in colllections
, a sequence form is mentioned very often for the parameters antialiased(s)
. However, it is not totally consistent with this one here, as most of them state that is has to be boolean or sequence of boolean (or 0 and 1 values)… I'll try to have a deeper look today.
Closing in favor of #8861 (which is just these commits rebased) @afvincent If you want to take this back over, close my PR or just push to my branch there. |
@tacaswell No problem with you taking over this PR. I will not have time for it during a little while anyway (just moved in to the US and starting a new postdoc => a bunch of things need to be handled first ^^) |
Fixes #8193.
Strings longer than a single character should now be OK as the
colors
parameter formatplotlib.axes.eventplot
. NB: before this PR,colors='rgb'
was OK as long as the length ofpositions
was equal to 3 too. As I do not know if “it is not bug, it is a feature!”™, the current PR keeps this behavior.I added an image test. I now realize that it may be a bit overkill… Should I rewrite the test to be a non-image one?
Besides I did some overhaul of the docstrings of
eventplot
andEventCollection
(BTW this PR should fix #7917 too) that seemed too be quite inexact, especially about what could be given ascolors
parameters For example, any list of valid colors was OK, eventhough the docstrings were asking for RGBA values only… (Being there, I tried to numpify the docstrings.)Pinging @anntzer for review as you opened #7917 and gave advices on #8193 😇 .