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
REF: drop unnecesasry if statement
  • Loading branch information
ivanovmg committed Oct 17, 2020
commit 201b25f519cb302516f128205ffa7172de42245d
3 changes: 0 additions & 3 deletions pandas/plotting/_matplotlib/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ def _get_default_colors(num_colors):
except KeyError:
colors = list(plt.rcParams.get("axes.color_cycle", list("bgrcmyk")))

Copy link
Member

Choose a reason for hiding this comment

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

in the original code, seems there is a check of colors in this branch, so does it mean after this refactoring, this won't happen? or colors shouldn't be a str in the first place once reaching this part of code?

if isinstance(colors, str):	
     colors = list(colors)

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, in this particular function colors will not be a string. This check is effectively carried out in _get_colors_from_color.

if isinstance(colors, str):
colors = list(colors)

return colors[0:num_colors]


Expand Down