-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
Default parameters for Graph.plot() and Graph.show() #13891
Comments
comment:2
I think the option could be termed as Also, why did you decide to create another dictionary, when there is already |
comment:3
Really ?
Well, because the Btw, I will try to deal with the pictures of our Belgian evening in Singapour sooner or later Have fuuuuuuuuuuuuuuuuuunn ! Nathann |
comment:4
Replying to @nathanncohen:
Yes, they are ugly. But this acts like a global variable in the file. Also if (and that's a big if, looking at my near future) I get time, I will try to clean up some of the options in plots (#13828), so I would prefer there are less inconsistencies introduced in new patches! :)
Whoops! Of course! That was so silly of me.
Great! By the way that's a nice way to mention Singapore - it is really pouring all day long here!
You too! Wish you a happy new year!
|
comment:5
Helloooooooo !!
I am glad we agree on that. Patch updated, ugliness included.
Oops sorry ! French spelling Have fuuuuuuuuuuuuuuuuuuuuuunnn !! Nathann |
Replying to @nathanncohen:
Gosh, I love that feature! Actually, I would love it even more if it could be set for all plots at once. Happy new year! |
comment:7
Replying to @nthiery:
Here's a (the?) way
|
comment:8
Ok... Perhaps this should be written in the doc somewhere ? Nathann |
comment:9
By the way, even though this patch lost 100% of its interest for me, I guess it can still be useful at some point for somebody who would like larger nodes or something. So if somebody feels like giving it a review Nathann P.S. I will update it in a couple of seconds to include Punarbasu's (very sensible) remark |
comment:10
@nathanncohen: First of call, thanks for this cleanup! Now, here are some comments:
|
comment:11
Patch updated ! As for the bug, it's yet another combinat side-effect The decorator added a dictionary of default options to all graphs, and some code in this file modifies the dictionary so that THIS graph will be well displayed. Vincent : it seems to come from your patch #11422. How do you propose that we fix this ? Nathann |
comment:12
Oh, and there's something else that I would like to know. Does this decorator mean that in order to define a default option for two graphs, you made all Graph objects carry an additional dictionary ? Nathann |
comment:13
Hi Nathann,
In the method in Arithgroup.coset_graph() I create a graph and modify the option dictionnary in order that color_by_label is True by default. The reason is that I want a nice picture with
If you provide another way to initialize the default options to plot/show, just tell me and I can do it or do it yourself. Otherwise, remove the annoying line in ArithmeticSubgroup_Permutation. Cheers, |
comment:14
Well, I guess that can be easily solved this way : would the "options" decorator work if you used it with empty parameters ? Something like that :
This way the dictionary of default arguments would be empty unless you fill it manually, and as a result the general default options from this patch would be used. This being said, this Nathann |
comment:15
Here it is, with the solution given above. This patch is waiting for a review again Nathann |
comment:16
Attachment: trac_13891.patch.gz I tested the patch. All tests passed. Documentation builds fine. The intended behavior works well for me. Although, here are some remarks below. Mainly, I believe it should be better documented in the doc string of plot and show methods. I also added some questions...
Can you provide an example instead? like:
The following point are just questions... A. Somebody can explain me what is the specification differences between B. Why do you remove the element from the kwds? Is there some efficiency gain?
C. Should not
D. What is this?
|
Reviewer: Punarbasu Purkayastha, Sébastien Labbé |
comment:18
Replying to @seblabbe:
This is fine. It is not for efficiency, but to remove the kwds which are not handled by the
I have no opinion on this. As long as it works, I am fine with either of None or {}. :) I have been quite tied up with deadlines lately, so sorry for the delay in reviewing this. Currently, this doesn't apply to 5.6.beta0. I will see if I have an older compiled version that I can use. What I wanted to test and check was whether it is possible to set some value in |
comment:19
Replying to @ppurka:
For me, I think the confusion comes from the fact that using plot actually opens the png. I like it if plot returns the Graphics object without opening any png and show returning None and openning the png. Thanks for your answers! I will continue my review (on sage-5.6.rc0 the patch applies fine) and let you check the other SHOW_OPTIONS thing. Sébastien |
comment:20
Replying to @seblabbe:
Actually, plot never returns the rendered graphics object. What happens when you don't assign any variable to plot like
then the |
comment:21
One more point. This does not affect the result of plot:
One may say it is because I should use
Hence, I believe the documentation at the start of the file |
comment:22
Replying to @ppurka:
So, I believe this is the reason of my confusion. Do we really want a string representation function like |
comment:23
Replying to @seblabbe:
You can do so too :) Just run |
This comment has been minimized.
This comment has been minimized.
comment:44
Patchbot apply trac_13891-all_in_one.patch |
comment:45
Questions. A. Sorry to ask this question, but why is figsize not an option for B. If I understand correctly,
but
Right? Comments. C. This works:
D. This is now ok:
|
Attachment: trac_13891-fifth_pass.patch.gz |
comment:46
Attachment: trac_13891-bugfix.patch.gz Soooooooooooo ! I just refolded them all to check where the missing line in
And of course attachment: trac_13891-all_in_one.patch applies all that. Now, to answer Sebastian's questions :
Well, if you like it, this "small patch that defines new default options" can go Thanks for your help !!! Nathann Apply trac_13891-all_in_one.patch |
comment:47
About A - the reason is that figsize is a property that is handled by matplotlib. |
comment:48
Replying to @ppurka:
So if somebody uses |
comment:49
Attachment: trac_13891_note-sl.patch.gz
To know available options for
or at the following docstring :
But, for show, it seems more difficult to know the possible options. The keywords of the default dict contain only one :
and the docstring of
Could we add a sentence in the above show docstring explaining where we can find what are the possible options for show accepted by matplotlib? |
Attachment: trac_13891-docagain.patch.gz Attachment: trac_13891-otherfixes.patch.gz |
Attachment: trac_13891-all_in_one.patch.gz Apply only this. |
comment:50
Added attachment: trac_13891-docagain.patch and attachment: trac_13891-otherfixes.patch. They're folded inside of attachment: trac_13891-all_in_one.patch. Nathann Apply trac_13891-all_in_one.patch |
comment:51
The options for show can be obtained directly from the top level function |
comment:52
Replying to @ppurka:
Thanks Nathann for your quick patch fixes and Punarbasu for your quick responses to my too many questions. Like you said, the patch now makes much more than the initial goal, but I think it is a good thing. Sébastien |
comment:53
Wouhouuuuuuuuuuuuuuuuuuuuuu !! Thaaaaaaaaaaaaanks ! Nathann |
comment:54
Thanks Sebastien for pushing both of us - me to have a look at this again, and Nathann for doing all the grunt work ;) |
Merged: sage-5.7.beta3 |
comment:56
This has annoyed the hell out of me about 100 times in the last month:
I strongly disagree with this deprecation. It is an extremely useful feature that the plotting functions hold their arguments, then pass the unused arguments on to show, just like the do (by design!) in 3d graphics, and did do (by design!) for many years in 2d graphics. |
comment:57
Your turn. Silently ignored arguments annoyed the hell out of me for a while too. I had no idea why nothing happened.
I have nothing against passing arguments from a function to another. I have something against failing silently. Now we have a list of arguments which are understood and used by show/plot, and you can use that to check that what you forward to another function will actually be used. You can also do the same everywhere else, and add these flags to the the documentation, which is far from being a rule everywhere else. http://www.sagemath.org/doc/reference/plotting/sage/graphs/graph_plot.html Nathann |
comment:58
I agree we should never deprecate it as I guess so much code are using useless arguments out there. Maybe the "DeprecationWarning" was not well chosen, just a "Warning" would have been ok without mentionning any future deprecation. So, what annoyed you in fact? The deprecation? or the warning that was printed 100 times? On my side, I would be happy to learn that the input I am giving to a function is just totally ignored. Why? Because this is just normal Python I am used to (we can also think of a mispell argument written by dyslexicy) :
|
comment:59
I agree that options should not be ignored silently - so in that sense I agree with Nathann. On the other hand, it seems that some other plot functions silently pass on their options to the show() method. I think something similar should be done here. I have opened #14632 to track this. |
comment:60
Replying to @ppurka:
I also agree that options should not be completely ignored silently. I want them to be passed on to the show command, which would then complain if the options are invalid.
Looking now, I see that I agree with what you propose there. |
Some cleaning there, and some doc, ... and a way for me to define a default size for Graph plots, even if I am not allowed to hardcode it in Sage because of the notebook.
Here are the new lines in my init.sage file :
Hell Yeahhhhhhhhhhhhhhhhhhh !!
:-P
Nathann
Apply to devel/sage
Depends on #13862
CC: @dcoudert @nthiery @hivert @videlec
Component: graph theory
Author: Nathann Cohen
Reviewer: Punarbasu Purkayastha, Sébastien Labbé
Merged: sage-5.7.beta3
Issue created by migration from https://trac.sagemath.org/ticket/13891
The text was updated successfully, but these errors were encountered: