-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix and document lightsource argument in mplot3d #9990
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
Conversation
bf013b7
to
915e522
Compare
915e522
to
57fe938
Compare
Alright, rebased. |
flake8 failure |
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.
Minor style issue: Always put a period at the end of a Parameter description, even if it‘s just an Expression like „Data values as 1D arrays.“. (Multiple occurrences)
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
always disabled when cmap is specified | ||
|
||
lightsource : LightSource | ||
The lightsource to use when `shade` is True |
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.
would be nice if this referenced the LightSource api docs since this isn't a common thing.
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
Whether to shade the facecolors. Defaults to True. Shading is | ||
always disabled when cmap is specified | ||
lightsource : LightSource | ||
The lightsource to use when `shade` is True |
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.
cross ref to the LIghtSource class. Also, would it make sense to give a rough description of what the default light source would be?
This didn't respect the x and y coordinates, so plotting `x{::-1], y{::-1], z[::-1,::-1]` would result in different shading to `x, y, z`. It also looked super screwy, and could only be triggered if `facecolors="do something wacky"` was passed
57fe938
to
ec18ea9
Compare
PEP8 and periods fixed. Feel free to edit docs in place here |
Can I do that directly in the parameter types as |
Please use: |
@timhoffm: Done |
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.
Some docstring issues to be fixed (sorry to be a bit picky here, but we want to have good looking consistent documentation).
Otherwise looks good.
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
Minimum and maximum value to map. | ||
shade : bool | ||
Whether to shade the facecolors. Defaults to True. Shading is | ||
always disabled when `cmap` is specified. |
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.
*cmap*
We use *cmap*
to denote other variables.
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
Whether to shade the facecolors. Defaults to True. Shading is | ||
always disabled when `cmap` is specified. | ||
lightsource : `~matplotlib.colors.LightSource` | ||
The lightsource to use when `shade` is True. |
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.
*shade*
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
Parameters | ||
---------- | ||
X, Y, Z : array-like | ||
Data values as 1D arrays |
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.
Descriptions should end with a period, even if they are only expressions and not full sentences.
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
X, Y, Z : array-like | ||
Data values as 1D arrays | ||
color | ||
Color of the surface patches |
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.
period
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
Whether to shade the facecolors. Defaults to True. Shading is | ||
always disabled when `cmap` is specified. | ||
lightsource : `~matplotlib.colors.LightSource` | ||
The lightsource to use when `shade` is True. | ||
|
||
The (optional) triangulation can be specified in one of two ways; |
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.
There can be no text block in a parameters section in numpydoc style. This would be interpreted as further parameters, which doesn't look nice
Please move this block before the parameters section.
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
@@ -1917,7 +1922,8 @@ def plot_trisurf(self, *args, color=None, norm=None, vmin=None, vmax=None, | |||
Other arguments are passed on to |
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.
Same text block in parameters section problem. We work around that by summarizing this under a **kwargs
parameter:
**kwargs
All other keyword argument are passed to
`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`.
always disabled when `cmap` is specified. | ||
|
||
lightsource : `~matplotlib.colors.LightSource` | ||
The lightsource to use when `shade` is True. |
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.
We use *shade*
to denote other variables.
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.
Looks like I missed this instance, sorry.
@timhoffm: Updated. I'm starting to regret updating the documentation to the new format... |
I'm sorry about that. I know that changing the documentation format is quite a hassle. However, a good and consistent documentation is essential for a complex library like matplotlib. We still have a long way to go, but we have already made some progress with the docs. It's a long-running effort which has to be taken one small step at a time. So thanks again for helping with this. This is good to go. We just need a second review. |
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.
👍 Thanks a lot! This looks like something that could do with a figure test at some point, but I'll leave that until another PR.
PR Summary
Fixes the problems in #8877, where the
lightsource
argument is broken in silly ways.This has been sitting in my working tree a while now, but is freshly rebased.
PR Checklist