-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
added functionality to obtain subplots from already created plots. #16276
Conversation
✅ Hi, I am the SymPy bot (v145). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.5. Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
The PR is not completely finished, but I would need some reviews regarding what has been implemented. |
Can you please add some screen shots here to see the effect of it? Looks interesting! |
Also, some simple usage example in the documentation (or here) may help for trying it out. |
I have tested the following example:
|
I realize that most things I commented on are from the old code... Either way, I think it looks very promising! However, I do not really have much insight into this part of the code so there are probably more suitable people for commenting on that... |
@@ -293,32 +293,30 @@ class PlotGrid(object): | |||
"""This class helps to plot subplots from already created sympy plots | |||
in a single figure | |||
""" | |||
def __init__(self, nrows, ncolumns, *args, show=True): | |||
def __init__(self, nrows, ncolumns, *args, **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.
Yes, this is an issue with 2.7... Could one possibly consider having the plots in a list? Not sure what is the better option.
If you merge the current master you will not get this seemingly failed check as it is removed (from there). |
Codecov Report
@@ Coverage Diff @@
## master #16276 +/- ##
============================================
+ Coverage 73.257% 73.74% +0.483%
============================================
Files 618 619 +1
Lines 158200 158698 +498
Branches 37175 37196 +21
============================================
+ Hits 115893 117025 +1132
+ Misses 36783 36255 -528
+ Partials 5524 5418 -106 |
Hello, all. I wrote this plotting module a few years ago, but I have not been involved with SymPy development for a while, so take my comments with a grain of salt. The changes seem generally correct to me. The gist of it is "add another level of indirection, and now loop over a list of There is a large set of plotting tests that probably need to be inspected visually before accepting this for merging. Originally, there were also a couple of plotting example notebooks that should be inspected visually by a human as well. I have only one negative comment, but if the core devs deem it nitpicky feel free to disregard it (it is somewhat stylistic too): A major part of the change involves mostly adding another level of indentation to already existing code. This is generally a reliable sign that a smaller, more self-contained change might be possible with the same effect. I believe here this is the case: the code will be more legible if instead of making the Another sign that this might be a good idea is this piece of code. I believe it would be easier to follow if this is again part of the proposed function that calls
However, there is a good argument against doing what I am suggesting: it bakes in the assumption that Either way, thanks for updating this code! |
Another thing that might need to be considered: is the API suggested here extendable to permit things like shared axes, or subplot grids of various sizes? |
@ishanaj, thanks for following the suggested changes. In general feel free to push back against such suggestions: you are the one that has made the changes and the code is freshest in your mind, not mine. In this case I think the changes were good (look at the number of changed lines in the diff - now it is noticeably fewer changes). I could continue nitpicking about the choice of function names (which one starts with Anyway, if a human has checked visually what the test results for the old plots are, I am in favor of this being merged. |
For shared axes, I think, one thing that could be done is taking
And yes, it does permit to have subplot grids of various sizes. Although it currently cannot append or extend the size of the grid. I have added some examples in documentation |
@Krastanov Do I also have to add some tests in |
@ishanaj I think the plot_test.py has been modified since the last time I have used it... You might be able to see the plots it creates saved in a temporary folder somewhere ( I would suggest opening the notebooks related to plotting from here: https://github.com/sympy/sympy/tree/d383496deb5bed647ed930fd0194c0f57dba495d/examples/beginner and checking whether they look reasonable with all the changes you have made. I would be surprised if there are any problems, but better safe than sorry. |
@Krastanov I have checked most of the examples and tallied the results with the old plot. There seems to be no difference in the results. I guess we are good to go. |
Everything sounds great to me. From my, admittedly outdated, experience with the project, this seems like a neat pull request worthy of merging. |
I have corrected a minor bug and also have added |
Great work here. I left a few comments. I like the API. |
Also, I found out that the current master(and this branch) are not giving results for the Although SymPy version 1.3 does give a result for the same. EDIT: I opened an issue regarding the same #16572 . |
@moorepants I have made the required changes. Please have a look. |
I'm good with this PR. Nice work! |
Sorry, I forgot to include the documentation in the |
I think the PR is good to go now! |
@oscargus and @Krastanov Are you all happy with this? If so I'll merge (or you can). |
Yes, my last comment stands. This seems well done to me. |
I'm going to merge. Thanks everyone. |
Thanks! |
This PR gives a solution to the problem as discussed in Issue #15328
A class
PlotGrid
have been introduced inplot.py
of plotting module. This class takes some already createdPlot
objects and makes a subplot figure usingmatplotlib
backend.TODO's:
Release Notes
PlotGrid