Skip to content

Dark background #40836

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

Closed
wants to merge 248 commits into from
Closed

Dark background #40836

wants to merge 248 commits into from

Conversation

yeshsurya
Copy link
Contributor

@yeshsurya yeshsurya commented Apr 8, 2021

  • [*] tests added / passed
  • [*] Ensure all linting tests pass, see here for how to run them
  • [*] Color in boxplot.py should be a hex value. Letter based color will be at matplotlib level. Using same color as that of boxes for the caps as well. The color will be fetched based on the selected theme. We are over riding color with "k" , rather need to use the one set at matplotlib level.

Before Fix :

Caps for the box plot is not visible :
image

After Fix :

Caps for the box plow will be visible in dark background mode :
image

Whats New : Box Plot's Caps will have same color as boxes unless color is explicitly specified by user arguments. Hence theme changes will not adversly effect caps color.

@pep8speaks
Copy link

pep8speaks commented Apr 8, 2021

Hello @yeshsurya! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-05-06 07:17:23 UTC

Copy link
Member

@mzeitlin11 mzeitlin11 left a comment

Choose a reason for hiding this comment

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

Thanks for the pr, @yeshsurya! Could you please add a whatsnew note describing what is fixed by this patch? Looks like there are some test failures (https://github.com/pandas-dev/pandas/pull/40836/checks?check_run_id=2298265089)

Also looks like some style checks are failing, this portion of the contributing guide should be helpful there (https://pandas.pydata.org/docs/development/contributing.html#pre-commit).

Could you also post a before/after of what this change does with respect to the original issue?

dark_result = df.boxplot(return_type="dict")
for k, v in dark_expected.items():
assert dark_result[k][0].get_color() == v
plt.style.use('defult')
Copy link
Member

Choose a reason for hiding this comment

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

Should this be

Suggested change
plt.style.use('defult')
plt.style.use('default')

?

{"boxes": "#1f77b4","whiskers": "#1f77b4","medians":"#2ca02c","caps":"#1f77b4"})
],
)
def test_colors_in_theme(self, dark_expected,default_expected):
Copy link
Contributor

Choose a reason for hiding this comment

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

this parametrising has no purpose since there is only one item in the list. You might as well define these variables in the function.

what is better is to restructure it so you only test one thing at a time:
e.g:

@pytest.mark.parametrize(
        "scheme, expected",
        [
            ('dark_background', {"boxes": "#8dd3c7","whiskers": "#8dd3c7","medians":"#bfbbd9","caps":"#8dd3c7"}),
            ('default', {"boxes": "#1f77b4","whiskers": "#1f77b4","medians":"#2ca02c","caps":"#1f77b4"})
        ],
    )

then the code for your test can be half as long.

Copy link
Contributor

@attack68 attack68 left a comment

Choose a reason for hiding this comment

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

if your code changes the attribute _caps_c to colors[0] why is the test still testing the value that the color for caps is k?

@yeshsurya
Copy link
Contributor Author

if your code changes the attribute _caps_c to colors[0] why is the test still testing the value that the color for caps is k?

yes , it shouldn't be. I was invoing df.boxplot() in test but I should be testing df.plot.box(). I've changed this.

Copy link
Contributor

@attack68 attack68 left a comment

Choose a reason for hiding this comment

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

seems like you have addressed my comments. LGTM.

Copy link
Member

@charlesdong1991 charlesdong1991 left a comment

Choose a reason for hiding this comment

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

nice! Could you please add a whatsnew note?

otherwise LGTM!

@jreback jreback added this to the 1.3 milestone Apr 13, 2021
@jreback
Copy link
Contributor

jreback commented Apr 13, 2021

looks fine if you can add a whatsnew note as @charlesdong1991 suggests and ping on green (bug fix section of 1.3 in visualization)

@yeshsurya
Copy link
Contributor Author

looks fine if you can add a whatsnew note as @charlesdong1991 suggests and ping on green (bug fix section of 1.3 in visualization)

Added whatsnew note

@jreback
Copy link
Contributor

jreback commented Apr 13, 2021

looks fine if you can add a whatsnew note as @charlesdong1991 suggests and ping on green (bug fix section of 1.3 in visualization)

Added whatsnew note

did you push ? it doesn't show up

@yeshsurya
Copy link
Contributor Author

looks fine if you can add a whatsnew note as @charlesdong1991 suggests and ping on green (bug fix section of 1.3 in visualization)

Added whatsnew note

did you push ? it doesn't show up

Oops ! Missed it. Pushed it now .

jbrockmendel and others added 27 commits May 6, 2021 14:25
* times in ewm groupby: sort times in according to grouping; add missing support for times in numba implementation; fix bug in cython implementation

* add GH issue id to tests

* fix typing validation error

* PR comments

* trying to fix int64 to int32 casting TypeError

* PR comments

* PR comments

* PR comments
…das-dev#41004)

* fix: function _take_with_is_copy was defined final but overriden

* fix: add return type
* TYP: get_indexer

* update per discussion in pandas-dev#40612

* one more overload

* pre-commit fixup
@yeshsurya
Copy link
Contributor Author

Another cleaner pull request raised for this : #41349

@charlesdong1991
Copy link
Member

emm, okay, @yeshsurya , then I will close this PR to make way for the other one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.