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
Add new plot style: stackplot #819
Conversation
Hooray, only two commits this time! |
+1 |
Parameters | ||
---------- | ||
*x* : 1d array of dimension N | ||
*y* : 2d array of dimension MxN |
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 should probably clarify here what's in the comment below: that the data is not "pre-stacked".
It might also be nice for y to be either a 2d array of MxN, or a variable number of y arguments (which would be stacked implicitly here).
This is great! Barring my minor comments, I think this is good to go. (And I think the color thing could be done as a second step if necessary -- my other comments are more important, IMHO). |
Thanks for your feedback @mdboom. GitHub is great for code review and feedback. I love it. None of these most recent commits include the |
I think this is ready to merge. Will leave it up for a few more days in case others would like to comment. |
pyplot.py needs update, as well as some docs (front page, what's new and API changes). I haven't looked over the docstrings yet. |
I've been trying to figure out what @WeatherGod means by 'pyplot.py needs an update'. I think I figured it out. I add
I then spent an hour trying figure out what was going wrong. Long story short:
How should I deal with this? Deleting it manually is not a solution because any time anybody else runs |
This perhaps should be re-evaluated in relation to the related PR #847. The example should be converted into a unit test. Other than that, this looks generally good to me. |
It does appear to need a rebase at the very least. Most likely due to changes in pyplot.py? |
You mean you want me to rebase against current master? I can do that. Are there any changes you wish me to make before I rebase? |
Changes before rebasing would only complicate things. There still remains discussion regarding design decisions, but at least we would have a working branch to refer to in this manner. |
I've rebased against master. |
@dmcdougall: Unfortunately this will need rebasing again due to some changes to the boilerplate script. It is possible that you will get conflicts there and in the actual pyplot file. The good news is that you can now simply run boilerplate.py and it automatically updates pyplot for you. Once you have done that, and added the example code as a simple unit test, I will merge the PR. Great work! |
Stackplot adds the feature request in issue matplotlib#359 (matplotlib#359) and borrows heavily from Doug Y'barbo's stackoverflow answer (http://stackoverflow.com/questions/2225995/how-can-i-create-stacked-line-graph-with-matplotlib).
The data *y* is assumed to be unstacked. This is now explicitly said in the docstring for the paramater *y*.
stackplot now supports taking either an MxN array of data, stacking along axis=0, or an arbitrary number of 1xN arrays, stacking them in the order passed. No checks are done for the case when no the number of args is zero. An exception should probably be raised here. Updated docstring to explain new call signatures.
Stackplot example now reflects usage of variadic calling signature.
…_between(). This is a measure to make boilerplate.py not produce a pyplot.py file with syntax errors. It's also a sensible course of action considering new stackplot features will almost certainly require keyword arguments anyway.
pyplot.py now contains the necessary information to make stackplot work inside of pyplot.
New keyword argument 'colors' can be passed to allow custom colouring of the stacked areas in a stacked area plot.
@pelson Thanks for the feedback. I've rebased and saw a conflict in |
Aha! I ninja pushed through a proxy. All sorted now! |
@dmcdougall: Ideally, I would just like to get a unittest added and then I can press the big green merge button ;-) |
Test images added. Unit test writted and unit test added to default tests in __init__.py
Done. Let me know if I messed anything up. I followed the guidelines here. Thanks. |
Don't think you need the |
I have no idea why that was there; the test produced it. Maybe because I am using the pdf backend by default? Anyway, it's gone. |
So the tests, by default, produce a png, a svg and a pdf, but in order to do the test comparison they are rasterised into |
I merged this manually to mpl. I moved your test into the test_axes module and squashed the commits into one (see 5675ffa). Thanks for all your work (and patience) on this PR. |
Is there a way to remove the black lines between the polygons? |
Oh, yeah, this will do it:
|
Stackplot currently takes Y in a transposed format.. should that be fixed? |
Well transposed or not depends on the layout of your data. This is probably not the best place to discuss such changes. Comments on an old closed issue/PR are likely to be lost. If you want to suggest changes please either use the mailing list or create a new open issue/PR |
Ok, done: #4952 |
This addresses issue #359.
There is also an example so you can try out the pull request. Sample output from this code is provided below:
Feedback is greatly appreciated, as always.