-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Shade color #2745
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
Shade color #2745
Conversation
…ken a given color by a given percentage
…ken a given color by a given percentage (altered CC to ColorConverter)
|
||
r,g,b = hls2rgb(h,l,s) | ||
|
||
return r,g,b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs a new line at the end of the file.
Ok, I've put a lot of comments here. In principle this is fine (I wish we had a "color" class to attach this as a method to, but that is for another day) - I've been rather picky about the PEP8 compliance in this PR, I do apologise, particularly since the file you've modified isn't especially PEP8 compliant in the first place, but we have to start somewhere, right? 😄 Finally, a simple unit test for this would be hugely valuable I think - it doesn't have to be super clever, just a 3 liner to put in a color, lighten it, and check the result. Thanks @dvreed77 and @tacaswell. |
|
||
h,l,s = rgb2hls(*rgb) | ||
|
||
l *= 1 + float(percent)/100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using np.clip for the clipping part.
Thanks for the comments. I have some newbie questions that you might be able to help out with. I created this function in a separate file and when it was working the way I wanted it to I copied and pasted it into my github forked repository and pushed it. My question is, how can I test it while its in place of my forked repository since this version of matplotlib isn't the one that its in my python path. I tried to insert the github version at index 0 in my python path, but get the following error when trying to import tests ~/code/matplotlib/lib/matplotlib/transforms.py in () ImportError: No module named _path I implemented a tests within test_colors.py |
I don't know it is possible to run the tests in-place (see #2175 ) I would suggest using virtual environments. The other option is to push your changes to your branch at let travis do the testing for you. |
My "test" is a plot that takes a color, lightens and darkens and applies On Wed, Jan 22, 2014 at 11:59 AM, Thomas A Caswell <notifications@github.com
|
It would be better to have a test something like |
@dvreed77 Any chance of this getting these issues addressed in the near future? We are starting the processes of triaging bugs for 1.4 and would like to get this in. We also need an entry in the change log and whats_new.rst |
I will try, been quite busy lately and was a little stumped the last time I On Mon, Feb 24, 2014 at 11:47 PM, Thomas A Caswell <notifications@github.com
|
@dvreed77 Any progress on this? |
I will work on it this weekend, sorry to be a slacker on this On Thu, Apr 3, 2014 at 10:23 PM, Thomas A Caswell
|
Punting this to 1.5. |
ping @dvreed77 |
@tacaswell working on this right now. Can you advise what you think the test should look like. I having trouble figuring this out. |
FIX: Implement draw_idle in macOSX backend
DOC: slightly update demo
MNT: Remove unused code in pdf backend
DOC: whats_new for axes.labelpad
MEP12 on annotation_demo.py
MEP12 on axes_props.py
MEP12-on-anscombe.py
MEP12-on-arrow_demo.py
MEP12 on axis_equal_demo.py
…ken a given color by a given percentage
…ken a given color by a given percentage (altered CC to ColorConverter)
…ken a given color by a given percentage, added modifications noted in PR #2745 which included fixing PEP8 errors and adding a test.
…ken a given color by a given percentage, added modifications noted in PR #2745 which included fixing PEP8 errors and adding a test.
@@ -1,3 +1,4 @@ | |||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stray merge marker
…ken a given color by a given percentage, added modifications noted in PR matplotlib#2745 which included fixing PEP8 errors and adding a test.
…ken a given color by a given percentage, added modifications noted in PR matplotlib#2745 which included fixing PEP8 errors and adding a test.
…ken a given color by a given percentage, added modifications noted in PR matplotlib#2745 which included fixing PEP8 errors and adding a test.
…ken a given color by a given percentage, added modifications noted in PR matplotlib#2745 which included fixing PEP8 errors and adding a test.
code to address #2159