-
-
Notifications
You must be signed in to change notification settings - Fork 480
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 legends to plot.py #4342
Comments
Attachment: trac_4342.patch.gz |
comment:1
Add the option to put legends on plots. Also fixes three long test markers that where reading #long rather than #long time and two or three minor documentation mistakes elsewhere in the code. These where bundled because they don't warrant a separate ticket for me but are still nice to fix. |
comment:2
New patch to pass options around in a better way. Also now use |
Attachment: trac_4342-2.patch.gz |
comment:3
For the patch trac_4342.patch, here are possible fixes to your documentation:
|
Attachment: trac_4342-3.patch.gz mvngu's doc fixes |
comment:4
Replying to @sagetrac-mvngu:
I uploaded a patch with these fixes. Mvngu, in the future please upload patches with your doc fixes. Thanks :) |
comment:5
Attachment: trac_4342.2.patch.gz I've folded all the patches together and rebased them against plot.py refactoring. These are in trac_4342.2.patch . I'll try to give this a proper review sometime this weekend. |
comment:6
what's the status on this? Mike, did you have time to look at it? |
comment:7
The good news is that Mike Hansen's patch does apply cleanly to 3.2.2. The bad news is that this patch breaks some basic functionality:
raises a TypeError exception. That is serious but more serious (to me - maybe this exception is It seems to me (and people who know about the Graphics class can hopefully
I'm happy to change my opinion (since IMHO this added functionality would be great), |
comment:8
There is no such thing as "negative review", but there is "needs work". Cheers, Michael |
Attachment: trac_4342_v3.patch.gz |
comment:9
Attachment: trac_4342_v3.2.patch.gz The last patch (trac_4342_v3.2.patch) fixes the TypeError problem and add tests and documentation where appropriate (can't believe I missed these). As far as I know, there is no way to get the function that's being plotted from the GraphicsPrimitve object (except maybe for some specialized primitives like Circle) because all you have is a matrix of sample points. So I don't think it is a good way. About the center point, it is already possible to specify a tuple of floats between 0 and 1 that gives the relative coordinates of the legend box. And last, about the design, I kind of copied it from matplotlib where each object is labeled beforehand. I could always provide an option to specify legend labels in show() and save() but due to the design of Graphics I think this would be shaky at best because the user has now reliable way of knowing the content of a Graphics object. Anyway if some clever way of overcoming the obstacle(s) above is found then something like what you want could be implemented in a later patch. |
comment:10
Can you please explain exactly which patches to apply and in which order from a new clone of Sage? I can't get them to apply cleanly. |
comment:11
You only need trac_4342_v3.2.patch. Ignore all others. |
comment:12
Again, I am having trouble running tests, so I can't say if they all pass. The examples seem fine (if somewhat too few). Still, which this very clever bit of programmming, this block of commands
produces a beautiful plot of two curves, one red and the other blue, and the legend labels are collected into a distinctive light grey box with the correct labels. Wonderful!! |
comment:36
This applies cleanly against sage-4.6.alpha0, and most things seem to work well. I'm not sure I understand Jason's point about the suboptions and contour_plot. It does seem like that while contour_plot accepts the legend_label argument, it doesn't do anything. I'm not sure that's a deal-breaker though, maybe we can just add a note in the contour_plot docstring about that given contour_plot's nice sidebar functionality. At least on my system (mac 10.5, firefox), font_style='italic' doesn't do anything. Other font options seem to work though. Since the default behavior is to have this turned off, I am hoping this can get a positive review pretty soon. It may not be perfect but it seems good enough for incremental improvement. I will not give it a positive review myself yet since I don't understand all the issues. |
comment:37
I browsed through the patch, and things look okay. I'm downloading sage 4.6alpha so I can try it out. |
comment:39
When I build the docs
I can't find where this error is. |
comment:40
I can't give this a positive review since I helped write the last iteration. I am not sure what's going on with the docbuild either. |
Reviewer: Jason Grout |
Author: Arnaud Bergeron, Karl-Dieter Crisman |
comment:42
I think that username anakha is really abergeron in a previous username incarnation. Here is one example. |
Changed reviewer from Jason Grout to Jason Grout, Mike Hansen, Karl-Dieter Crisman |
comment:44
CCing two sphinx experts. When we apply trac-4342-rebase-4.6.alpha1.patch (only), we get the following error when building docs:
We don't know where it is coming from. Do you guys have any idea? |
comment:45
In the line
you need to change |
comment:46
ah, those are citation references, aren't they? Thanks! |
comment:47
John's fix is in the last patch. Release manager: please merge trac-4342-rebase-4.6.alpha1.patch, then 4342-fix-docs.patch. Positive review. Good job, everyone! Sorry this took so long to review! |
Attachment: trac-4342-rebase-4.6.alpha1.patch.gz apply only this patch; rebased to 4.6.alpha1 |
Attachment: 4342-fix-docs.patch.gz apply on top of previous patches |
comment:48
(I rebased to account for some changes on #9740) |
comment:49
Replying to @jasongrout:
Correct - see the ticket order a few comments ago. Applies fine to the latest changes at #9740. |
Merged: sage-4.6.alpha3 |
Add support for placing legends on plots using the matplotlib facility for doing so.
CC: @kcrisman @sagetrac-slosoi @novoselt @sagetrac-abergeron @jhpalmieri @sagetrac-mvngu
Component: graphics
Author: Arnaud Bergeron, Karl-Dieter Crisman
Reviewer: Jason Grout, Mike Hansen, Karl-Dieter Crisman
Merged: sage-4.6.alpha3
Issue created by migration from https://trac.sagemath.org/ticket/4342
The text was updated successfully, but these errors were encountered: