-
-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-36460: add default legend_color to eliminate KeyError when plottin…
…g 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. ### 📝 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: #36460 Reported by: DaveWitteMorris Reviewer(s): Kwankyu Lee
- Loading branch information
Showing
7 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters