sage.plot: Add/update # needs#36038
Conversation
| ....: region=lambda x,y,z: x<=t or y>=t or z<=t) | ||
| sage: a = animate([frame(t) | ||
| ....: for t in srange(.01,1.5,.2)]) | ||
| sage: a[0] # long time |
There was a problem hiding this comment.
L90 looks bad after splitting. Please insert spaces after commas.
There was a problem hiding this comment.
I guess I made these changes before deciding to use a file-level tag for sage.symbolic. Undone now in 0754253
dcoudert
left a comment
There was a problem hiding this comment.
Some questions, and some required changes.
| ....: for t in srange(.01,1.5,.2)]) | ||
| sage: a[0] # long time | ||
| Graphics3d Object | ||
| sage: a.show() # long time # optional -- ImageMagick |
There was a problem hiding this comment.
Just to be sure, are both forms accepted ? # optional -- ImageMagick and # optional - ImageMagick
There was a problem hiding this comment.
All of these forms accepted; sage -fixdoctests normalizes to the # optional - imagemagick form.
src/sage/plot/animate.py
Outdated
| sage: print(a) | ||
| Animation with 3 frames | ||
| sage: a.show() # optional -- ImageMagick | ||
| sage: a.show() # optional - imagemagick |
There was a problem hiding this comment.
OK, I am normalizing in this file to # optional -- ImageMagick because that seemed to be the preference of the author
There was a problem hiding this comment.
Don't we use uncapitalized names for all optional doctest tags, except this one? If we allow an exception, then the result would just be an inconsistency. I mean that some will use # optional - imagemagick anyway.
Is the author strong about this?
There was a problem hiding this comment.
Changing it to the fixdoctests normal form is also fine with me.
There was a problem hiding this comment.
We have other exceptions. For instance we use both gurobi and Gurobi:
xyz:sage dcoudert$ git grep "# optional - [gG]urobi" src/sage/
src/sage/combinat/matrices/dancing_links.pyx: sage: d.to_milp('gurobi') # optional - gurobi sage_numerical_backends_gurobi
src/sage/combinat/matrices/dancing_links.pyx: sage: s = d.one_solution_using_milp_solver('gurobi') # optional - gurobi sage_numerical_backends_gurobi
src/sage/combinat/matrices/dancing_links.pyx: sage: s in solutions # optional - gurobi sage_numerical_backends_gurobi
src/sage/features/mip_backends.py: sage: Gurobi()._is_present() # optional - gurobi
src/sage/knots/link.py: sage: L.plot(solver='Gurobi') # optional - Gurobi
src/sage/numerical/backends/cvxpy_backend.pyx: sage: p = MixedIntegerLinearProgram(solver="CVXPY/Gurobi"); p.solve() # optional - gurobi
src/sage/numerical/mip.pyx: sage: p = MixedIntegerLinearProgram(solver="gurobi") # optional - Gurobi
src/sage/numerical/mip.pyx: sage: p.add_constraint(p[0] - p[2], min=1, max=4) # optional - Gurobi
src/sage/numerical/mip.pyx: sage: p.number_of_variables() # optional - Gurobi
When running git grep "# optional - [[:upper:]]" src/sage/, we see occurrences of: # optional - SAGE_ROOT, # optional - CPLEX, # optional - Gurobi, # optional - Nonexistent_LP_solver, # optional - CHomP, # optional - FES , # optional - RSat.
I don't think we want to force the use of the uncapitalized form for SAGE_ROOT. At least we should be consistent inside a file.
There was a problem hiding this comment.
All right then. I won't insist.
src/sage/plot/complex_plot.pyx
Outdated
| sage: import numpy as np | ||
| sage: from sage.plot.complex_plot import add_lightness_smoothing_to_rgb | ||
| sage: add_lightness_smoothing_to_rgb(np.array([[[0, 0.25, 0.5]]]), np.array([[0.75]])) # abs tol 1e-4 | ||
| sage: import numpy as np # needs numpy |
src/sage/plot/graphics.py
Outdated
| sage: p = plot(y, -4.1, 1.1) | ||
| sage: xlines = lambda a,b: [z for z,m in y.roots()] | ||
| sage: p.show(gridlines=[xlines, [0]], frame=True, axes=False) | ||
| sage: y = x^5 + 4*x^4 - 10*x^3 - 40*x^2 + 9*x + 36 # needs sage.symbolic |
| - ``trange`` -- A 3-tuple `(t,t_{\min},t_{\max})` where t is the independent variable of the curve. | ||
|
|
||
| - ``phirange`` - A 2-tuple of the form `(\phi_{\min},\phi_{\max})`, (default `(0,\pi)`) that specifies the angle in which the curve is to be revolved. | ||
| - ``phirange`` -- A 2-tuple of the form `(\phi_{\min},\phi_{\max})`, (default `(0,\pi)`) that specifies the angle in which the curve is to be revolved. |
There was a problem hiding this comment.
Could do the alignment on 80 columns
There was a problem hiding this comment.
Too much for this ticket
There was a problem hiding this comment.
True, it's already a giant one ;)
src/sage/plot/plot3d/shapes.pyx
Outdated
| sage: G += G.translate(2.3, 0, -.5) | ||
| sage: G += G.translate(3.5, 2, -1) | ||
| sage: G.show(aspect_ratio=1, frame=False) | ||
| sage: G += sum(Cylinder(.2, 1).translate(cos(2*pi*n/9), sin(2*pi*n/9), 0) # needs sage.symbolic |
| sage: B = MyAnimation([graphs.CompleteGraph(n) for n in range(7,11)], figsize=5) | ||
| sage: B = MyAnimation([graphs.CompleteGraph(n) | ||
| ....: for n in range(7,11)], figsize=5) | ||
| sage: d = B.png() |
There was a problem hiding this comment.
I am not sure if we should count leading spaces to check 80 characters limit. 80 characters without counting leading spaces look fine in the rendered doc.
src/sage/plot/plot.py
Outdated
| sage: g2 = plot(cos(x), 0, 2*pi, linestyle="--") | ||
| sage: (g1+g2).show(ticks=pi/6, tick_formatter=pi) # long time # show their sum, nicely formatted | ||
| sage: (g1 + g2).show(ticks=pi/6, # show their sum, nicely formatted # long time | ||
| ....: tick_formatter=pi) |
There was a problem hiding this comment.
The bot reports this alignement error. 4 spaces missing before ....:
|
Documentation preview for this PR (built with commit e18852a; changes) is ready! 🎉 |
|
Thanks! |
sagemathgh-36038: `sage.plot`: Add/update `# needs` <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> - Part of: sagemath#29705 - Cherry-picked from: sagemath#35095 <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36038 Reported by: Matthias Köppe Reviewer(s): David Coudert, Kwankyu Lee, Matthias Köppe
📝 Checklist
⌛ Dependencies