Fix and document lightsource argument in mplot3d#9990
Fix and document lightsource argument in mplot3d#9990dstansby merged 5 commits intomatplotlib:masterfrom
Conversation
bf013b7 to
915e522
Compare
915e522 to
57fe938
Compare
|
Alright, rebased. |
flake8 failure |
timhoffm
left a comment
There was a problem hiding this comment.
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.
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.
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 |
timhoffm
left a comment
There was a problem hiding this comment.
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.
*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. |
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.
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 |
| 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.
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.
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.
We use *shade* to denote other variables.
There was a problem hiding this comment.
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. |
dstansby
left a comment
There was a problem hiding this comment.
👍 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
lightsourceargument is broken in silly ways.This has been sitting in my working tree a while now, but is freshly rebased.
PR Checklist