Commit
2 years ago
gh-36460: add default legend_color to eliminate KeyError when plotting arrow2d or disk Fixes #36153. The line `g._legend_colors = [options['legend_color']]` appears in the code for seven graphics objects. Five of them (`circle`, `ellipse`, `line2d`, `point2d`, and `polygon2d`) set `None` as the default value for `legend_color`. The other two (`arrow2d` and `disk`) do not set a default, so a `KeyError` is raised if a `legend_label` is supplied, but no `legend_color` is specified. This bug was pointed out in #36153. This PR adds `None` as the default value of `legend_color` in `arrow2d` and `disk`. It also adds the corresponding doctest to all seven of these graphics objects, except `line2d`, which already has the example `line([(0,0),(1,1)], legend_label='line')`. The PR also corrects a typo in the docstring of the `cone` graphic object. ### :memo: Checklist - [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. - [x] I have created tests covering the changes. URL: https://github.com/sagemath/sage/pull/36460 Reported by: DaveWitteMorris Reviewer(s): Kwankyu Lee
Author
Release Manager
Loading