From 285966f6ad73e4db61b32c41fd952babb23645d1 Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Fri, 13 Oct 2023 11:24:23 -0600 Subject: [PATCH 1/2] #36153 fix legend_color KeyError --- src/sage/combinat/root_system/plot.py | 2 +- src/sage/plot/arrow.py | 9 ++++++++- src/sage/plot/circle.py | 4 ++++ src/sage/plot/disk.py | 6 +++++- src/sage/plot/ellipse.py | 5 +++++ src/sage/plot/point.py | 4 ++++ src/sage/plot/polygon.py | 7 ++++++- 7 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/sage/combinat/root_system/plot.py b/src/sage/combinat/root_system/plot.py index 34c178cef8f..a1eec40e8df 100644 --- a/src/sage/combinat/root_system/plot.py +++ b/src/sage/combinat/root_system/plot.py @@ -1349,7 +1349,7 @@ def cone(self, rays=[], lines=[], color="black", thickness=1, alpha=1, wireframe - ``alpha`` -- a number in the interval `[0, 1]` (default: `1`) the desired transparency - - ``label`` -- an object to be used as for this cone. + - ``label`` -- an object to be used as the label for this cone. The label itself will be constructed by calling :func:`~sage.misc.latex.latex` or :func:`repr` on the object depending on the graphics backend. diff --git a/src/sage/plot/arrow.py b/src/sage/plot/arrow.py index 179e026d2e4..f5baa03d8d9 100644 --- a/src/sage/plot/arrow.py +++ b/src/sage/plot/arrow.py @@ -489,7 +489,8 @@ def arrow(tailpoint=None, headpoint=None, **kwds): @rename_keyword(color='rgbcolor') -@options(width=2, rgbcolor=(0,0,1), zorder=2, head=1, linestyle='solid', legend_label=None) +@options(width=2, rgbcolor=(0,0,1), zorder=2, head=1, linestyle='solid', + legend_label=None, legend_color=None) def arrow2d(tailpoint=None, headpoint=None, path=None, **options): """ If ``tailpoint`` and ``headpoint`` are provided, returns an arrow from @@ -640,6 +641,12 @@ def arrow2d(tailpoint=None, headpoint=None, path=None, **options): :: sage: arrow2d((-2,2), (7,1)).show(frame=True) + + TESTS: + + Verify that :trac:`36153` is fixed:: + + sage: A = arrow2d((-1,-1), (2,3), legend_label="test") """ from sage.plot.all import Graphics g = Graphics() diff --git a/src/sage/plot/circle.py b/src/sage/plot/circle.py index 41281b66735..1134be434b1 100644 --- a/src/sage/plot/circle.py +++ b/src/sage/plot/circle.py @@ -406,6 +406,10 @@ def circle(center, radius, **options): sage: P = circle((1,1), 1) sage: P.aspect_ratio() 1.0 + + Verify that :trac:`36153` does not arise:: + + sage: C = circle((1,1), 1, legend_label="test") """ from sage.plot.all import Graphics diff --git a/src/sage/plot/disk.py b/src/sage/plot/disk.py index 91891b84550..bbc79394810 100644 --- a/src/sage/plot/disk.py +++ b/src/sage/plot/disk.py @@ -247,7 +247,7 @@ def plot3d(self, z=0, **kwds): @rename_keyword(color='rgbcolor') @options(alpha=1, fill=True, rgbcolor=(0, 0, 1), thickness=0, legend_label=None, - aspect_ratio=1.0) + legend_color=None, aspect_ratio=1.0) def disk(point, radius, angle, **options): r""" A disk (that is, a sector or wedge of a circle) with center @@ -346,6 +346,10 @@ def disk(point, radius, angle, **options): Traceback (most recent call last): ... ValueError: the center point of a plotted disk should have two or three coordinates + + Verify that :trac:`36153` is fixed:: + + sage: D = disk((0, 0), 5, (0, pi/2), legend_label="test") """ from sage.plot.all import Graphics g = Graphics() diff --git a/src/sage/plot/ellipse.py b/src/sage/plot/ellipse.py index 791b719fe68..d483996ae88 100644 --- a/src/sage/plot/ellipse.py +++ b/src/sage/plot/ellipse.py @@ -345,6 +345,11 @@ def ellipse(center, r1, r2, angle=0, **options): E=ellipse((0,0),2,1,legend_label="My ellipse", legend_color='green') sphinx_plot(E) + TESTS: + + Verify that :trac:`36153` does not arise:: + + sage: E = ellipse((0,0), 2, 1, legend_label="test") """ from sage.plot.all import Graphics g = Graphics() diff --git a/src/sage/plot/point.py b/src/sage/plot/point.py index 2bbe8cef07a..a689b152bc8 100644 --- a/src/sage/plot/point.py +++ b/src/sage/plot/point.py @@ -579,6 +579,10 @@ def point2d(points, **options): sage: point2d(iter([])) Graphics object consisting of 0 graphics primitives + + Verify that :trac:`36153` does not arise:: + + sage: P = point((0.5, 0.5), legend_label="test") """ from sage.plot.plot import xydata_from_point_list from sage.plot.all import Graphics diff --git a/src/sage/plot/polygon.py b/src/sage/plot/polygon.py index 6f2c2b3f78b..86d0d6599c6 100644 --- a/src/sage/plot/polygon.py +++ b/src/sage/plot/polygon.py @@ -524,10 +524,15 @@ def polygon2d(points, **options): sage: polygon2d([[1,2], [5,6], [5,0]]).aspect_ratio() 1.0 + TESTS: + + Verify that :trac:`36153` does not arise:: + + sage: P = polygon2d([[1,2], [5,6], [5,0]], legend_label="test") + AUTHORS: - David Joyner (2006-04-14): the long list of examples above. - """ from sage.plot.plot import xydata_from_point_list from sage.plot.all import Graphics From f2dfb7b868352236cca348ad335be1ebe662617f Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Sat, 14 Oct 2023 08:58:12 -0600 Subject: [PATCH 2/2] change :trac: to :issue: --- src/sage/plot/arrow.py | 2 +- src/sage/plot/circle.py | 2 +- src/sage/plot/disk.py | 2 +- src/sage/plot/ellipse.py | 2 +- src/sage/plot/point.py | 2 +- src/sage/plot/polygon.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sage/plot/arrow.py b/src/sage/plot/arrow.py index f5baa03d8d9..26bb131f713 100644 --- a/src/sage/plot/arrow.py +++ b/src/sage/plot/arrow.py @@ -644,7 +644,7 @@ def arrow2d(tailpoint=None, headpoint=None, path=None, **options): TESTS: - Verify that :trac:`36153` is fixed:: + Verify that :issue:`36153` is fixed:: sage: A = arrow2d((-1,-1), (2,3), legend_label="test") """ diff --git a/src/sage/plot/circle.py b/src/sage/plot/circle.py index 1134be434b1..c7fd3d9dfc0 100644 --- a/src/sage/plot/circle.py +++ b/src/sage/plot/circle.py @@ -407,7 +407,7 @@ def circle(center, radius, **options): sage: P.aspect_ratio() 1.0 - Verify that :trac:`36153` does not arise:: + Verify that :issue:`36153` does not arise:: sage: C = circle((1,1), 1, legend_label="test") """ diff --git a/src/sage/plot/disk.py b/src/sage/plot/disk.py index bbc79394810..3b2c72051b9 100644 --- a/src/sage/plot/disk.py +++ b/src/sage/plot/disk.py @@ -347,7 +347,7 @@ def disk(point, radius, angle, **options): ... ValueError: the center point of a plotted disk should have two or three coordinates - Verify that :trac:`36153` is fixed:: + Verify that :issue:`36153` is fixed:: sage: D = disk((0, 0), 5, (0, pi/2), legend_label="test") """ diff --git a/src/sage/plot/ellipse.py b/src/sage/plot/ellipse.py index d483996ae88..821906ecf0a 100644 --- a/src/sage/plot/ellipse.py +++ b/src/sage/plot/ellipse.py @@ -347,7 +347,7 @@ def ellipse(center, r1, r2, angle=0, **options): TESTS: - Verify that :trac:`36153` does not arise:: + Verify that :issue:`36153` does not arise:: sage: E = ellipse((0,0), 2, 1, legend_label="test") """ diff --git a/src/sage/plot/point.py b/src/sage/plot/point.py index a689b152bc8..7e880ca3c1c 100644 --- a/src/sage/plot/point.py +++ b/src/sage/plot/point.py @@ -580,7 +580,7 @@ def point2d(points, **options): sage: point2d(iter([])) Graphics object consisting of 0 graphics primitives - Verify that :trac:`36153` does not arise:: + Verify that :issue:`36153` does not arise:: sage: P = point((0.5, 0.5), legend_label="test") """ diff --git a/src/sage/plot/polygon.py b/src/sage/plot/polygon.py index 86d0d6599c6..a2159fcfb56 100644 --- a/src/sage/plot/polygon.py +++ b/src/sage/plot/polygon.py @@ -526,7 +526,7 @@ def polygon2d(points, **options): TESTS: - Verify that :trac:`36153` does not arise:: + Verify that :issue:`36153` does not arise:: sage: P = polygon2d([[1,2], [5,6], [5,0]], legend_label="test")