Skip to content

CLN: clean color selection in _matplotlib/style #37203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Nov 4, 2020
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0f1b99a
REF: extract functions
ivanovmg Oct 17, 2020
901453a
CLN: remove try/except/ZeroDivisionError
ivanovmg Oct 17, 2020
201b25f
REF: drop unnecesasry if statement
ivanovmg Oct 17, 2020
8e13df5
CLN: simplify logic
ivanovmg Oct 17, 2020
37a820d
DOC: add short docstrings
ivanovmg Oct 17, 2020
3883a13
CLN: simplify logic further
ivanovmg Oct 17, 2020
f93743c
TYP: add type annotations
ivanovmg Oct 17, 2020
b4c3267
REF: more explicitly handle string color
ivanovmg Oct 17, 2020
6af1543
FIX: fix mpl registry reset
ivanovmg Oct 17, 2020
31125f7
TYP: fix typing in _get_colors_from_color
ivanovmg Oct 18, 2020
45647a4
CLN: eliminate use of legacy "axes.color_cycle"
ivanovmg Oct 18, 2020
393ae46
REF: extract generator function to simplify logic
ivanovmg Oct 18, 2020
fe66213
TST: add tests for get_standard_colors
ivanovmg Oct 18, 2020
1626108
CLN: drop list comprehension for generator expr
ivanovmg Oct 18, 2020
79b0f08
TYP: annotate get_standard_colors
ivanovmg Oct 18, 2020
f513bdb
DEP: add testing dependency (cycler)
ivanovmg Oct 18, 2020
76f7663
Remove test_style temporary
ivanovmg Oct 18, 2020
0f0f4bc
BLD: remove cycler from dependencies temporary
ivanovmg Oct 18, 2020
b8daf79
Revert "Remove test_style temporary"
ivanovmg Oct 19, 2020
37734e8
REF: import cycler from matplotlib.pyplot
ivanovmg Oct 19, 2020
765836f
TST: mark test skip if no mpl
ivanovmg Oct 19, 2020
4479e37
Merge branch 'master' into cleanup/matplotlib-style
ivanovmg Oct 19, 2020
dd9efd7
Merge branch 'master' into cleanup/matplotlib-style
ivanovmg Oct 20, 2020
f0ea701
REF: use pytest.importorskip
ivanovmg Oct 23, 2020
dedd0dd
REF: extract new method _is_single_color
ivanovmg Oct 30, 2020
b369834
DOC: add/update docstrings
ivanovmg Nov 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CLN: simplify logic
  • Loading branch information
ivanovmg committed Oct 17, 2020
commit 8e13df506d6fa8f143efa84473342c46984be138
5 changes: 4 additions & 1 deletion pandas/plotting/_matplotlib/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ def _get_colors_from_color(color):
if len(color) == 0:
raise ValueError("Invalid color argument: {color}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need an f in front?

just to clarify: what was the reason to check ValueError here? seems original error message gives an empty string, while here is an empty iterable? is this on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this check to avoid try/except ZeroDivisionError (in the original code), which would be happening when color == "". I will make it an f-string, I missed that.


if is_list_like(color) and not isinstance(color, dict):
if isinstance(color, dict):
return color

if is_list_like(color):
return list(color)

if _is_single_color(color):
Expand Down