Skip to content

Commit b7c6367

Browse files
committed
Merge branch 'region_plot' of github.com:egourgoulhon/sage into options_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.
2 parents beb94bc + 80fd0a9 commit b7c6367

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/sage/plot/contour_plot.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,9 +1391,10 @@ def f(x,y):
13911391
raise ValueError("fill=%s is not supported" % options['fill'])
13921392

13931393

1394-
@options(frame=False, axes=True, legend_label=None, aspect_ratio=1)
1395-
def region_plot(f, xrange, yrange, plot_points=100, incol='blue', outcol=None, bordercol=None,
1396-
borderstyle=None, borderwidth=None, alpha=1, **options):
1394+
@options(plot_points=100, incol='blue', outcol=None, bordercol=None,
1395+
borderstyle=None, borderwidth=None, frame=False, axes=True,
1396+
legend_label=None, aspect_ratio=1, alpha=1)
1397+
def region_plot(f, xrange, yrange, **options):
13971398
r"""
13981399
``region_plot`` takes a boolean function of two variables, `f(x, y)`
13991400
and plots the region where f is True over the specified
@@ -1657,6 +1658,14 @@ def region_plot(f, xrange, yrange, plot_points=100, incol='blue', outcol=None, b
16571658
from warnings import warn
16581659
import numpy
16591660

1661+
plot_points = options['plot_points']
1662+
incol = options.pop('incol')
1663+
outcol = options.pop('outcol')
1664+
bordercol = options.pop('bordercol')
1665+
borderstyle = options.pop('borderstyle')
1666+
borderwidth = options.pop('borderwidth')
1667+
alpha = options.pop('alpha')
1668+
16601669
if not isinstance(f, (list, tuple)):
16611670
f = [f]
16621671

@@ -1675,9 +1684,9 @@ def region_plot(f, xrange, yrange, plot_points=100, incol='blue', outcol=None, b
16751684
if neqs and not bordercol:
16761685
bordercol = incol
16771686
if not f:
1678-
return implicit_plot(feqs[0], xrange, yrange, plot_points=plot_points,
1679-
fill=False, linewidth=borderwidth,
1680-
linestyle=borderstyle, color=bordercol, **options)
1687+
return implicit_plot(feqs[0], xrange, yrange, fill=False,
1688+
linewidth=borderwidth, linestyle=borderstyle,
1689+
color=bordercol, **options)
16811690
f_all, ranges = setup_for_eval_on_grid(feqs + f,
16821691
[xrange, yrange],
16831692
plot_points)

0 commit comments

Comments
 (0)