Skip to content
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

remove duplicate args in @options() in region_plot #36296

Merged
merged 3 commits into from
Sep 24, 2023

Conversation

dimpase
Copy link
Member

@dimpase dimpase commented Sep 18, 2023

This is needed for Sphinx 7.1+, as outlined in #36295 and discovered in #36276

This will resolve #36295

It also fixes a bug in region_plot, where in some cases plot_points were not passed to the backend.

This is needed for Sphinx 7.1+
@kwankyu
Copy link
Collaborator

kwankyu commented Sep 18, 2023

As I understand it (from reading examples), the options decorator allows the user to set defaults to the listed options (via region_plot.options). If you remove them, then the user will lose the ability for those options. Hence your change is a regression. If duplicate args cause problems, I think you should remove the duplicates from the function definition itself, not from the decorator.

That is the theory. You should test.

@dimpase
Copy link
Member Author

dimpase commented Sep 18, 2023

There seems to be no documentation on such a use of @options() AFAIK this is the only usage of @options() decorator in Sage where this name clashing is happening (e.g. not in the other places @options() is called in the file in question). Soure code docstring is also rather unclear to me

class options():
    def __init__(self, **options):
        """
        A decorator for functions which allows for default options to be
        set and reset by the end user.  Additionally, if one needs to, one
        can get at the original keyword arguments passed into the
        decorator.

and there is no example of the use of @options() as we see in the contour_plot, the code in question. Here is my experiment:

$ ./sage --python
Python 3.11.5 (main, Sep 15 2023, 11:47:22) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sage.misc.decorators import options
>>> @options(a=42)
... def g(f,a):
...    print(a)
... 
>>> g(1,2) # we can't pass the value of a explicitly here
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dimpase/work/software/sage/src/sage/misc/decorators.py", line 497, in wrapper
    return func(*args, **options)
           ^^^^^^^^^^^^^^^^^^^^^^
TypeError: g() got multiple values for argument 'a'
>>> g(1)
42

So it appears that we can just as well write g simply as

def g(f,a=42):
      print(a)

to almost the same effect (the only difference is that we still can call g with 2 arguments, but calling it with only one argument will lead to the same result as in the @options() version.

@dimpase
Copy link
Member Author

dimpase commented Sep 18, 2023

I think if you want to object to this change, you'd have to come up with a meaningful doctest which shows that the proposed change breaks something.

@dimpase
Copy link
Member Author

dimpase commented Sep 18, 2023

Calling the original author of these lines: @jhonrubiagonzalez

Also, it seems @vbraun touched some @options() in this file.

People, what was it meant to do?!

@dimpase
Copy link
Member Author

dimpase commented Sep 18, 2023

Anyhow, I have built the Sage docs using Sphinx 7.2.6, and I can see the difference in picture quality as the number of plot_points used in calls to region_plot is increased. I have also checked that setting various colors is args of region_plot works.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 18, 2023

It is used like this:

sage: from sage.misc.decorators import options
sage: @options(a=42)
....: def g(f,a):
....:     print(a)
....: 
sage: 
sage: g(1)
42
sage: g.options
{'a': 42}
sage: g.options['a'] = 43
sage: g(1)
43

This is certainly very useful, especially for plotting functions which typically have lots of options. You can set the defaults for options as you want, and the subsequent function calls would get those defaults.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 18, 2023

A proper fix for problems including the present one with Sphinx 7.1+ would involve updating (or better removing) src/sage_docbuild/ext/sage_autodoc.

@dimpase
Copy link
Member Author

dimpase commented Sep 18, 2023

what does this particular bug have to do with autodoc?

@dimpase
Copy link
Member Author

dimpase commented Sep 18, 2023

The present branch allows overriding the defaults which are not listed in @options() just as well:

sage: region_plot.options
{'frame': False, 'axes': True, 'legend_label': None, 'aspect_ratio': 1}
sage: region_plot.options['plot_points']=1000
sage: region_plot.options
{'frame': False,
 'axes': True,
 'legend_label': None,
 'aspect_ratio': 1,
 'plot_points': 1000}
sage: var('x,y')
(x, y)
sage: g = region_plot([x**2 + y**2 < 1, x < y], (x,-2,2), (y,-2,2))
sage: g.save("/home/dimpase/tmp/g1000_2.svg") # this is 1000 plot points plot; the original default is 100 plot points

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 18, 2023

Then you can get rid of all options listed in @options(...) and list them in the function arguments list instead? Or vice versa?

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 18, 2023

what does this particular bug have to do with autodoc?

Just guess. Sphinx autodoc has to do with extracting function signature to document the function. We can suspect that the new Sphinx has a problem with dealing with the decorated function...

I have no exact idea.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 18, 2023

Then you can get rid of all options listed in @options(...) and list them in the function arguments list instead? Or vice versa?

If so, why not just put everything on either @options(...) or the function arguments list? Splitting them at an arbitrary line is confusing.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 18, 2023

Anyhow, I have built the Sage docs using Sphinx 7.2.6, and I can see the difference in picture quality as the number of plot_points used in calls to region_plot is increased. I have also checked that setting various colors is args of region_plot works.

Doesn't this prove that adding an argument in @options(...) or not makes a difference? I misunderstood.

@dimpase
Copy link
Member Author

dimpase commented Sep 18, 2023

Then you can get rid of all options listed in @options(...) and list them in the function arguments list instead? Or vice versa?

If so, why not just put everything on either @options(...) or the function arguments list? Splitting them at an arbitrary line is confusing.

Note that region_plot has **options as an argument. And then in the function body options is used. If we, say, make it empty, this would be different behaviour, I guess.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 18, 2023

I am experimenting with @options() (empty list). I see no difference... Any difference in pickling...?

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 19, 2023

After looking at the code, I think there's no difference in behavior wherever arguments are put. One difference is the documentation. Seeing the output of region_plot.options, you can see what options are available.

In this point of view, you should put as many arguments to @options(...) as you see deserve to be included in the options list interesting to users.

Hence, after all, removing options from @options(...) is a regression (a slight one in documentation).

It seems to me that this is a slight price for getting Sphinx 7.1+, so I am okay with your change if you add a comment there about why and what options were removed from the list in what PR.

@orlitzky
Copy link
Contributor

The present branch allows overriding the defaults which are not listed in @options() just as well:

That's lucky, I didn't think the behavior would be the same.

Note that region_plot has **options as an argument. And then in the function body options is used.

The default options dictionary has now changed, though. Do these three lines do the same thing after the change, where options has been stripped of most of its keys?

return implicit_plot(feqs[0], xrange, yrange, plot_points=plot_points,
                     fill=False, linewidth=borderwidth,
                     linestyle=borderstyle, color=bordercol, **options)
g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax']))
g.add_primitive(ContourPlot(xy_data_array, xrange, yrange,
                            dict(contours=[-1e-20, 0, 1e-20],
                                 cmap=cmap,
                                 fill=True, **options)))

@orlitzky
Copy link
Contributor

If so, why not just put everything on either @options(...) or the function arguments list? Splitting them at an arbitrary line is confusing.

I think putting them in region_plot.options is confusing in the first place. The @options magic is used only in sage, and there inconsistently. Most people have no idea what it is or how to use it. It's just an obtuse way to pass default options to a function, and python has a standard alternative. How the arguments to a function work is not something you should have to stop and think about.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 19, 2023

I agree. I didn't know it exists.

I don't object to deprecating the options decorator. @egourgoulhon may have more experiences in plotting.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 19, 2023

I searched for the options decorator. It is used extensively in plot module.

@orlitzky
Copy link
Contributor

I searched for the options decorator. It is used extensively in plot module.

Something like .01% of the functions that take options though.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 19, 2023

Back to the original issue, removing duplicates from the function arguments list, instead of @options(...) list, is the right way to solve this issue.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 19, 2023

Note that region_plot has **options as an argument. And then in the function body options is used. If we, say, make it empty, this would be different behaviour, I guess.

That catches all keyword arguments from @options(...) decorator, and the function definition, and the user supplied ones.

I meant @options() by "empty".

@dimpase
Copy link
Member Author

dimpase commented Sep 19, 2023

Back to the original issue, removing duplicates from the function arguments list, instead of @options(...) list, is the right way to solve this issue.

This would break, potentially, the order of the positional arguments of the function. It might be OK though. I'll check.

@egourgoulhon
Copy link
Member

egourgoulhon commented Sep 19, 2023

Back to the original issue, removing duplicates from the function arguments list, instead of @options(...) list, is the right way to solve this issue.

I fully agree. Having some of the arguments of @options in the function argument list is not correct. They should be removed from the function argument list, not from @options.

Side comment: fixing this will probably fix the missing link to region_plot in the list at the top of the 2D plotting section of the reference manual:
https://doc.sagemath.org/html/en/reference/plotting/sage/plot/plot.html

@dimpase
Copy link
Member Author

dimpase commented Sep 19, 2023

Back to the original issue, removing duplicates from the function arguments list, instead of @options(...) list, is the right way to solve this issue.

I fully agree. Having some of the arguments of @options in the function argument list is not correct. They should be removed from the function argument list, not from @options.

I tried this, it just doesn't work. One has to understand how that blasted @option work better than me.
I'm getting

sage -t --warn-long 21.9 --random-seed=329640674077002804385470819635015891914 src/sage/plot/contour_plot.py
**********************************************************************
File "src/sage/plot/contour_plot.py", line 1203, in sage.plot.contour_plot.implicit_plot
Failed example:
    implicit_plot(x**2 + y**2 == 2, (x,-3,3), (y,-3,3), fill=True, fillcolor='red')
Expected:
    Graphics object consisting of 2 graphics primitives
Got:
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'incol'=red
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'outcol'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'bordercol'=blue
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'borderstyle'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'borderwidth'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'alpha'=1
    verbose 0 (163: primitive.py, options) 
    The allowed options for ContourPlot defined by a 150 x 150 data grid are:
        cmap           the name of a predefined colormap,
                            a list of colors, or an instance of a
                            matplotlib Colormap. Type: import matplotlib.cm;
                            matplotlib.cm.datad.keys()
                            for available colormap names.
        colorbar       Include a colorbar indicating the levels                    
        colorbar_optionsa dictionary of options for colorbars                       
        contours       Either an integer specifying the number of
                            contour levels, or a sequence of numbers giving
                            the actual contours to use.
        fill           Fill contours or not                                        
        label_options  a dictionary of options for the labels                      
        labels         show line labels or not                                     
        legend_label   The label for this item in the legend.                      
        linestyles     the style of the lines to be plotted                        
        linewidths     the width of the lines to be plotted                        
        plot_points    How many points to use for plotting precision               
        zorder         The layer level in which to draw                            
    <BLANKLINE>
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'incol'=red
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'outcol'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'bordercol'=blue
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'borderstyle'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'borderwidth'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'alpha'=1
    verbose 0 (163: primitive.py, options) 
    The allowed options for ContourPlot defined by a 150 x 150 data grid are:
        cmap           the name of a predefined colormap,
                            a list of colors, or an instance of a
                            matplotlib Colormap. Type: import matplotlib.cm;
                            matplotlib.cm.datad.keys()
                            for available colormap names.
        colorbar       Include a colorbar indicating the levels                    
        colorbar_optionsa dictionary of options for colorbars                       
        contours       Either an integer specifying the number of
                            contour levels, or a sequence of numbers giving
                            the actual contours to use.
        fill           Fill contours or not                                        
        label_options  a dictionary of options for the labels                      
        labels         show line labels or not                                     
        legend_label   The label for this item in the legend.                      
        linestyles     the style of the lines to be plotted                        
        linewidths     the width of the lines to be plotted                        
        plot_points    How many points to use for plotting precision               
        zorder         The layer level in which to draw                            
    <BLANKLINE>
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'incol'=red
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'outcol'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'bordercol'=blue
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'borderstyle'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'borderwidth'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'alpha'=1
    verbose 0 (163: primitive.py, options) 
    The allowed options for ContourPlot defined by a 150 x 150 data grid are:
        cmap           the name of a predefined colormap,
                            a list of colors, or an instance of a
                            matplotlib Colormap. Type: import matplotlib.cm;
                            matplotlib.cm.datad.keys()
                            for available colormap names.
        colorbar       Include a colorbar indicating the levels                    
        colorbar_optionsa dictionary of options for colorbars                       
        contours       Either an integer specifying the number of
                            contour levels, or a sequence of numbers giving
                            the actual contours to use.
        fill           Fill contours or not                                        
        label_options  a dictionary of options for the labels                      
        labels         show line labels or not                                     
        legend_label   The label for this item in the legend.                      
        linestyles     the style of the lines to be plotted                        
        linewidths     the width of the lines to be plotted                        
        plot_points    How many points to use for plotting precision               
        zorder         The layer level in which to draw                            
    <BLANKLINE>
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'incol'=red
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'outcol'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'bordercol'=blue
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'borderstyle'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'borderwidth'=None
    verbose 0 (163: primitive.py, options) WARNING: Ignoring option 'alpha'=1
    verbose 0 (163: primitive.py, options) 
    The allowed options for ContourPlot defined by a 150 x 150 data grid are:
        cmap           the name of a predefined colormap,
                            a list of colors, or an instance of a
                            matplotlib Colormap. Type: import matplotlib.cm;
                            matplotlib.cm.datad.keys()
                            for available colormap names.
        colorbar       Include a colorbar indicating the levels                    
        colorbar_optionsa dictionary of options for colorbars                       
        contours       Either an integer specifying the number of
                            contour levels, or a sequence of numbers giving
                            the actual contours to use.
        fill           Fill contours or not                                        
...

incomprehensible errors if I do

+++ b/src/sage/plot/contour_plot.py
@@ -1392,10 +1392,9 @@ def implicit_plot(f, xrange, yrange, **options):
 
 
 @options(plot_points=100, incol='blue', outcol=None, bordercol=None,
-         borderstyle=None, borderwidth=None, frame=False, axes=True,
-         legend_label=None, aspect_ratio=1, alpha=1)
-def region_plot(f, xrange, yrange, plot_points, incol, outcol, bordercol,
-                borderstyle, borderwidth, alpha, **options):
+         borderstyle=None, borderwidth=None, alpha=1,
+         frame=False, axes=True, legend_label=None, aspect_ratio=1)
+def region_plot(f, xrange, yrange, **options):
     r"""
     ``region_plot`` takes a boolean function of two variables, `f(x, y)`
     and plots the region where f is True over the specified
@@ -1659,6 +1658,14 @@ def region_plot(f, xrange, yrange, plot_points, incol, outcol, bordercol,
     from warnings import warn
     import numpy
 
+    plot_points = options['plot_points']
+    incol = options['incol']
+    outcol = options['outcol']
+    bordercol = options['bordercol']
+    borderstyle = options['borderstyle']
+    borderwidth = options['borderwidth']
+    alpha = options['alpha']
+
     if not isinstance(f, (list, tuple)):
         f = [f]
 
...
*********************************************************************
File "src/sage/plot/contour_plot.py", line 1650, in sage.plot.contour_plot.region_plot
Failed example:
    region_plot([x == 0], (x,-1,1), (y,-1,1))
Exception raised:
    Traceback (most recent call last):
      File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/doctest/forker.py", line 709, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.plot.contour_plot.region_plot[21]>", line 1, in <module>
        region_plot([x == Integer(0)], (x,-Integer(1),Integer(1)), (y,-Integer(1),Integer(1)))
      File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/misc/decorators.py", line 497, in wrapper
        return func(*args, **options)
               ^^^^^^^^^^^^^^^^^^^^^^
      File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/plot/contour_plot.py", line 1687, in region_plot
        return implicit_plot(feqs[0], xrange, yrange, plot_points=plot_points,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: sage.plot.contour_plot.implicit_plot() got multiple values for keyword argument 'plot_points'
...

and if I leave out assignments

    plot_points = options['plot_points']
    incol = options['incol']
...

in the function body I get errors about undefined local variables:

**********************************************************************
File "src/sage/plot/contour_plot.py", line 1203, in sage.plot.contour_plot.implicit_plot
Failed example:
    implicit_plot(x**2 + y**2 == 2, (x,-3,3), (y,-3,3), fill=True, fillcolor='red')
Exception raised:
    Traceback (most recent call last):
      File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/doctest/forker.py", line 709, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.plot.contour_plot.implicit_plot[8]>", line 1, in <module>
        implicit_plot(x**Integer(2) + y**Integer(2) == Integer(2), (x,-Integer(3),Integer(3)), (y,-Integer(3),Integer(3)), fill=True, fillcolor='red')
      File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/misc/decorators.py", line 497, in wrapper
        return func(*args, **options)
               ^^^^^^^^^^^^^^^^^^^^^^
      File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/plot/contour_plot.py", line 1382, in implicit_plot
        return region_plot(f < 0, xrange, yrange, borderwidth=linewidths,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/misc/decorators.py", line 497, in wrapper
        return func(*args, **options)
               ^^^^^^^^^^^^^^^^^^^^^^
      File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/plot/contour_plot.py", line 1692, in region_plot
        plot_points)
        ^^^^^^^^^^^
    NameError: name 'plot_points' is not defined

Unless we dig up someone who knows about @options, this is not going to fly. Or perhaps it's just not fixable this way, full stop.

@egourgoulhon
Copy link
Member

The code in the branch
https://github.com/egourgoulhon/sage/tree/region_plot
seems to solve the issue (all tests in src/sage/plotare passed).

@dimpase
Copy link
Member Author

dimpase commented Sep 19, 2023

The code in the branch https://github.com/egourgoulhon/sage/tree/region_plot seems to solve the issue (all tests in src/sage/plotare passed).

OK, but why you don't pop plot_points ? In the original code, in the scope of region_plot at its start, options don't contain plot_points. I added print(options) there, and see

sage: g = region_plot([x**2 + y**2 < 1, x < y], (x,-2,2), (y,-2,2))
{'frame': False, 'axes': True, 'legend_label': None, 'aspect_ratio': 1}
sage: g = region_plot([x**2 + y**2 < 1, x < y], (x,-2,2), (y,-2,2), plot_points=1000)
{'frame': False, 'axes': True, 'legend_label': None, 'aspect_ratio': 1}

(these are exactly the options with names not matching names of formal args of region_plot)

In your branch, after all the option popping, you'd still have plot_points in options, so
your code does something different, and, as far as I can see that's why you had to remove plot_points=plot_points, in the call to implicit_plot.

@dimpase
Copy link
Member Author

dimpase commented Sep 19, 2023

@egourgoulhon : Another problem is that your branch changes the number of positional args of region_plot, so this has to get in after deprecation.

How about we do my changes for the time being, and deprecate region_plot in its present state? Then, in about a year, we replace it by a variant of your branch?

@egourgoulhon
Copy link
Member

In your branch, after all the option popping, you'd still have plot_points in options, so your code does something different, and, as far as I can see that's why you had to remove plot_points=plot_points, in the call to implicit_plot.

There reason for keeping plot_points in options is that it is a valid option to be passed to ContourPlot in line 1752.

@egourgoulhon
Copy link
Member

@egourgoulhon : Another problem is that your branch changes the number of positional args of region_plot, so this has to get in after deprecation.

The current definition of region_plot is buggy. Shall we have a deprecation stage for a bug?

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 19, 2023

The real positional arguments are only f, xrange, yrange, other arguments are plotting options. I see no problem @egourgoulhon's code.

Let's get his code in. No deprecation is needed.

@dimpase
Copy link
Member Author

dimpase commented Sep 19, 2023

In your branch, after all the option popping, you'd still have plot_points in options, so your code does something different, and, as far as I can see that's why you had to remove plot_points=plot_points, in the call to implicit_plot.

There reason for keeping plot_points in options is that it is a valid option to be passed to ContourPlot in line 1752.

The current code does not pass it. And your code does pass it, right?

…ns_fix_in_contour_plot

This also fixes a bug in region_plot, so that plot_points are not
passed in calls to other functions via options.

This is because a @options decorator's argument are automatically popped
from "options" dict as soon as the function it decorates has an arg
with the same name.

In the change we reduce the number of positional arguments of
region_plot; thus the corresponding args of @options have to be popped
manually in the function body; we don't pop plot_points, to
pass it correctly in function calls.
@dimpase
Copy link
Member Author

dimpase commented Sep 19, 2023

OK, I've taken @egourgoulhon commit, and added a longer comment in the merge commit.

@egourgoulhon
Copy link
Member

In your branch, after all the option popping, you'd still have plot_points in options, so your code does something different, and, as far as I can see that's why you had to remove plot_points=plot_points, in the call to implicit_plot.

There reason for keeping plot_points in options is that it is a valid option to be passed to ContourPlot in line 1752.

The current code does not pass it. And your code does pass it, right?

Right. But it seems legitimate to do so, because plot_points is a valid option for the class ContourPlot, contrary to the other ones (i.e. the ones that are popped out).

@egourgoulhon
Copy link
Member

egourgoulhon commented Sep 19, 2023

Side comment: fixing this will probably fix the missing link to region_plot in the list at the top of the 2D plotting section of the reference manual: https://doc.sagemath.org/html/en/reference/plotting/sage/plot/plot.html

After regenerating the full doc, I confirm that this issue is fixed by the commit 80fd0a9

@egourgoulhon
Copy link
Member

Also, comparing with the naked eye all the plots of Sage 10.1 documentation at
https://doc.sagemath.org/html/en/reference/plotting/sage/plot/contour_plot.html
with the ones generated with the new branch, everything seems identical.

Copy link
Collaborator

@kwankyu kwankyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Let's wait for tests to pass.

@egourgoulhon
Copy link
Member

Side comment: fixing this will probably fix the missing link to region_plot in the list at the top of the 2D plotting section of the reference manual: https://doc.sagemath.org/html/en/reference/plotting/sage/plot/plot.html

After regenerating the full doc, I confirm that this issue is fixed by the commit 80fd0a9

This also fixes the missing region_plot item in the top-right menu "ON THIS PAGE".

@github-actions
Copy link

Documentation preview for this PR (built with commit b7c6367; changes) is ready! 🎉

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 19, 2023

It looks very good. Thanks everyone!

@vbraun vbraun merged commit 461727b into sagemath:develop Sep 24, 2023
20 checks passed
@mkoeppe mkoeppe added this to the sage-10.2 milestone Sep 24, 2023
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 25, 2023
    
This is a continuation of sagemath#36256

- Fixes sagemath#36301
- Fixes https://groups.google.com/g/sage-
release/c/1wOBmhvNJqc/m/Jk14VAbjBAAJ (hence marked critical)

### 📝 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.
- [x] 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


- sagemath#36296: to use an up to date Sphinx
- sagemath#36267: updated ipympl, etc

Also, a Jupyter/Python issue was uncovered there, which might need work.
    
URL: sagemath#36276
Reported by: Dima Pasechnik
Reviewer(s): Matthias Köppe, Michael Orlitzky
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 27, 2023
    
This is a continuation of sagemath#36256

- Fixes sagemath#36301
- Fixes https://groups.google.com/g/sage-
release/c/1wOBmhvNJqc/m/Jk14VAbjBAAJ (hence marked critical)

### 📝 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.
- [x] 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


- sagemath#36296: to use an up to date Sphinx
- sagemath#36267: updated ipympl, etc

Also, a Jupyter/Python issue was uncovered there, which might need work.
    
URL: sagemath#36276
Reported by: Dima Pasechnik
Reviewer(s): Matthias Köppe, Michael Orlitzky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix @options() in contour_lot to allow Sphinx 7.2.6
6 participants