Skip to content

Inconsistensy in pyplot.pcolormesh docstring regarding default value for shading #21314

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

Closed
navidcy opened this issue Oct 7, 2021 · 5 comments · Fixed by #21332
Closed

Inconsistensy in pyplot.pcolormesh docstring regarding default value for shading #21314

navidcy opened this issue Oct 7, 2021 · 5 comments · Fixed by #21332
Labels
Documentation Good first issue Open a pull request against these issues if there are no active ones!
Milestone

Comments

@navidcy
Copy link
Contributor

navidcy commented Oct 7, 2021

The function argument list here declares None as the default value for shading

def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
vmax=None, shading=None, antialiased=False, **kwargs):

but that does not seem to be in agreement with shading = 'flat' which is mentioned bit further down, namely at

shading : {'flat', 'nearest', 'gouraud', 'auto'}, optional
The fill style for the quadrilateral; defaults to
'flat' or :rc:`pcolor.shading`. Possible values:

(discovered by @hakaseh)

@navidcy navidcy changed the title Inconsistensy in pyplot.pcolormesh default value for shading Inconsistensy in pyplot.pcolormesh docstring regarding default value for shading Oct 7, 2021
@dstansby
Copy link
Member

Looking at the default values in rcParams the default value actually seems to be 'auto', so I think changing 'flat' to 'auto' in the docstring would fix this.

@dstansby dstansby added Documentation Good first issue Open a pull request against these issues if there are no active ones! labels Oct 10, 2021
@anntzer
Copy link
Contributor

anntzer commented Oct 10, 2021

@navidcy
Copy link
Contributor Author

navidcy commented Oct 10, 2021

@dstansby, are you suggesting that the docstring should be simply

The fill style for the quadrilateral; defaults to :rc:`pcolor.shading`.

?

@jklymak
Copy link
Member

jklymak commented Oct 11, 2021

I think so, though I am not 100% sure that I agree with this admonition because for non-rendered docs this doesn't help the user much. I somewhat prefer

defaults to :rc:`pcolor.shading` (usually 'auto')

but of course manually typing it makes it susceptible to being forgotten next time behaviour changes.

@timhoffm
Copy link
Member

I think so, though I am not 100% sure that I agree with this admonition because for non-rendered docs this doesn't help the user much. I somewhat prefer

defaults to :rc:`pcolor.shading` (usually 'auto')

but of course manually typing it makes it susceptible to being forgotten next time behaviour changes.

Because of this syncing issue, we do not do this. Also as of now, this would render to HTML as

defaults to rcParams['pcolor'.shading'] (default: 'auto') (usually 'auto')

which would be really confusing.

If somebody wants explicitly written defaults in the source, they need to adapt the :rc: admonition. And I highly recommend only doing that if you additionally add instrumentation to validate the correct defaults in CI.

@QuLogic QuLogic added this to the v3.5.0 milestone Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Good first issue Open a pull request against these issues if there are no active ones!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants