Skip to content

Commit

Permalink
sagemath#36153 fix legend_color KeyError
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveWitteMorris committed Oct 13, 2023
1 parent 2f1a76d commit 285966f
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/sage/combinat/root_system/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion src/sage/plot/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions src/sage/plot/circle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion src/sage/plot/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
5 changes: 5 additions & 0 deletions src/sage/plot/ellipse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions src/sage/plot/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/sage/plot/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 285966f

Please sign in to comment.