-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add EventCollection and eventplot #1657
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
linestyles = [linestyles] * len(positions) | ||
|
||
if len(lineoffsets) != len(positions): | ||
raise ValueError('lineoffsets and positions are unequal sized \ |
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.
Minor nitpick: this way of setting strings will indent the output in a weird way. There are several ways to avoid this, my favourite being:
raise ValueError("lineoffsets and positions are unequal sized "
"sequences.")
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.
Good point. I will fix that, but I will hold off committing it for a few
days to see if there are more substantial changes that should be done at
the same time.
You don't need to commit the png versions of the svg and pdf files. Please remove the files that end in "_pdf.png" and "_svg.png". |
Okay, I will do so. |
Very nice patch ! Both the code and documentation are very clear and very clean. |
Thank you very much! I was concerned the documentation was not clear |
I have made the recommended changes |
One remaining issue is all the whitespace in the generated pyplot code. Should that be left in, removed manually, or should I modify boilerplate.py to remove it automatically? I already have a modified version of boilerplate.py that strips all trailing spaces automatically, I could commit it if that is the best approach. |
I'd be pro modifying |
I agree with @mdboom, with the view that modifying |
Okay, then all suggestions so far have been implemented as far as I can |
@toddrjen Unfortunately, you'll need to rebase this against current master so that it will merge cleanly. |
As discussed in the mailing list, here is the event plot. It's purpose it to plot one or more series of 1D data points along horizontal or vertical lines. It is dived into two parts.
The first part is the EventCollection collections class, which is a subclass of LineCollection that makes it easy to create and manipulate individual rows of vertical lines or columns of horizontal lines. Besides being used in the final plot type, this is also useful on its own, for example for marking the locations of data points along an axis (see eventcollection_demo.py). Besides the convenience functions, since it is a subclass of LineCollection it also exposes all internal LineCollection and Collection methods, allowing more fine-grained modifications for artists.
The second part is an axes method (also in pyplot through boilerplate.py) which is given one or more rows of data points and creates corresponding rows or columns of lines. All rows or columns can be given the same line properties or individual line properties (see eventplot_demo.py). It returns a list of EventCollection objects.
Tests for both EventCollection and eventplot are present, and the files have been tested for pep8 compliance and run through pyflakes and pylint and fixed wherever appropriate.