-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Lightsource shade method parameters for color range definition #2650
Conversation
changes the lower and upper border of the colorspace. Compare with method contourf where these parameters are available.
How about accepting a Would you mind adding a test for this, I suspect there are 0 tests for the entire function... Thanks @syngron. |
parameter. * Added LightSource test case similar to example http://matplotlib.org/examples/pylab_examples/shading_example.html
The error in travis now comes from the test "ERROR: matplotlib.tests.test_contour.test_contour_manual_labels.test" which is IMHO not related to my added test. |
Please don't merge master into PR branches, it makes merging this branch back into master messy. Can you use |
Ok, I because this other error came up I thought that I have to merge them before new commits. "git push --force" gives only "Everything up-to-date". How can I proceed to fix this? |
@@ -205,6 +205,35 @@ def gray_from_float_rgba(): | |||
assert_raises(ValueError, gray_from_float_rgba) | |||
|
|||
|
|||
def test_light_source_shading_color_range(): |
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.
What is this testing? It doesn't actually assert anything as far as I can see.
Perhaps you could construct a LightSource and call its shade
method with a small array (like a (3, 4)
) and compare that with an expected result (using numpy.testing.assert_array_equal
or perhaps numpy.testing.assert_array_almost_equal
etc.).
@syngron - thanks for putting the norm as an argument to LightShade - I think this looks much better now and is consistent with most other color/scalable type objects in matplotlib. I've made a couple of comments, but I think this is looking really promising, so thank you for persevering! |
Sorry, should have been clearer, you need to roll back your local branch by one commit first (I normally do this using |
- basic example and assert statement in LightSource test
Ok thanks for the hints 👍 Sorry for the confusions but this is my first pull request. I admit that the test case was not a real test before, I wanted to change that later, now I did it. I also included the norm simplification in the shade method. |
This is looking good to me, thanks for your hard work @syngron. Thanks! |
@pelson You happy with merging this? |
Thanks for the nudge @tacaswell. |
Lightsource shade method parameters for color range definition
Added vmin and vmax arguments to LigthSource shade method which, if set, changes the lower and upper border of the colorspace. Compare with method contourf where these parameters are available. Basically they are needed if one has data in a smaller range than the colospace one wants to use. Normally the shade method just takes data.min() and data.max() as the range, by defining vmin and vmax thos get overwritten.