FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix and document lightsource argument in mplot3d by eric-wieser · Pull Request #9990 · matplotlib/matplotlib · GitHub

Repository navigation

Fix and document lightsource argument in mplot3d - #9990

Merged
dstansby merged 5 commits into
matplotlib:masterfrom
eric-wieser:lightsource-shading
Sep 16, 2018
Merged

dstansby merged 5 commits into
matplotlib:masterfrom
eric-wieser:lightsource-shading

Conversation

Copy link
Copy Markdown
Contributor

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

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

eric-wieser changed the title Lightsource shading Fix and document lightsource argument in mplot3d Dec 13, 2017

Copy link
Copy Markdown
Contributor Author

This will conflict with #9991, so lets deal with #9991 first

tacaswell added this to the v2.2 milestone Dec 13, 2017
tacaswell requested a review from WeatherGod December 13, 2017 19:59

eric-wieser commented Feb 9, 2018 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

#9991 is in, but I think this will conflict with #10001 too - so again, I plan to delay this one

eric-wieser force-pushed the lightsource-shading branch from 915e522 to 57fe938 Compare July 12, 2018 06:57

Copy link
Copy Markdown
Contributor Author

Alright, rebased.

Copy link
Copy Markdown
Member
./lib/mpl_toolkits/mplot3d/axes3d.py:1652:9: E303 too many blank lines (2)
1     E303 too many blank lines (2)

flake8 failure

timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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)

Comment thread lib/mpl_toolkits/mplot3d/axes3d.py Outdated
always disabled when cmap is specified

lightsource : LightSource
The lightsource to use when `shade` is True

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

would be nice if this referenced the LightSource api docs since this isn't a common thing.

Comment thread 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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
eric-wieser force-pushed the lightsource-shading branch from 57fe938 to ec18ea9 Compare July 13, 2018 16:57

Copy link
Copy Markdown
Contributor Author

PEP8 and periods fixed. Feel free to edit docs in place here

Copy link
Copy Markdown
Contributor Author

@WeatherGod:

cross ref to the LIghtSource class.

Can I do that directly in the parameter types as lightsource : `LightSource` ?

Copy link
Copy Markdown
Member

Please use: lightsource : `~matplotlib.colors.LightSource`

Copy link
Copy Markdown
Contributor Author

@timhoffm: Done

timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread 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.

timhoffm Aug 21, 2018 •
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

*cmap*

We use *cmap* to denote other variables.

https://matplotlib.org/devel/documenting_mpl.html#id3

Comment thread 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

*shade*

Comment thread lib/mpl_toolkits/mplot3d/axes3d.py Outdated
Parameters
----------
X, Y, Z : array-like
Data values as 1D arrays

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Descriptions should end with a period, even if they are only expressions and not full sentences.

Comment thread lib/mpl_toolkits/mplot3d/axes3d.py Outdated
X, Y, Z : array-like
Data values as 1D arrays
color
Color of the surface patches

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

period

lightsource : `~matplotlib.colors.LightSource`
The lightsource to use when `shade` is True.

The (optional) triangulation can be specified in one of two ways;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We use *shade* to denote other variables.

https://matplotlib.org/devel/documenting_mpl.html#id3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks like I missed this instance, sorry.

Copy link
Copy Markdown
Contributor Author

@timhoffm: Updated. I'm starting to regret updating the documentation to the new format...

timhoffm commented Sep 6, 2018 •
edited
Loading

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

👍 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.

dstansby merged commit 82a4b24 into matplotlib:master Sep 16, 2018
anntzer mentioned this pull request Sep 17, 2018
6 tasks
eric-wieser deleted the lightsource-shading branch March 23, 2019 18:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL