Skip to content

ENH: Styler.text_gradient: easy extension alternative to .background_gradient #41098

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 30 commits into from
May 25, 2021

Conversation

attack68
Copy link
Contributor

This is minor code alteration to the _background_gradient function that permits a text-only coloring version, i.e. Styler.text_gradient.

This could alternatively be performed with a text_only=True keyword addition to Styler.background_gradient existing method, but it seemed dissimilar enough to merit its own method (and avoid adding more kwargs).

Screen Shot 2021-04-22 at 14 24 45
Screen Shot 2021-04-22 at 14 24 57

@attack68 attack68 changed the title Text gradient ENH: Styler.text_gradient: easy extension alternative to .background_gradient Apr 22, 2021
Parameters
----------
cmap : str or colormap
Matplotlib colormap.
Copy link
Contributor

Choose a reason for hiding this comment

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

these match the kwargs for background_gradient? if not why not

Copy link
Contributor

Choose a reason for hiding this comment

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

can you use a shared doc-string?

Copy link
Contributor Author

@attack68 attack68 May 3, 2021

Choose a reason for hiding this comment

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

yes they all match its the same signature. Can you use a shared doc string even if the short summary/ extended summary part, and the examples are different? I've never used a shared doc string.. any tips where one is used that I can lookup and copy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nevermind.. i figured it out and made the changes.

@jreback jreback added Enhancement Styler conditional formatting using DataFrame.style labels May 3, 2021
@jreback jreback added this to the 1.3 milestone May 21, 2021
@jreback
Copy link
Contributor

jreback commented May 21, 2021

lgtm. can you rebase one more time and ping on green. also pls update the styler docs as a followon.

@attack68
Copy link
Contributor Author

@jreback pinging green now.

@simonjayhawkins simonjayhawkins merged commit 8327872 into pandas-dev:master May 25, 2021
@simonjayhawkins
Copy link
Member

Thanks @attack68

@attack68 attack68 deleted the text_gradient branch May 25, 2021 09:36
TLouf pushed a commit to TLouf/pandas that referenced this pull request Jun 1, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants