Repository navigation
Description
Problem
Key docstring information no longer appearing in v3.4 docs
Some class docstrings are omitted from the API pages,
making certain features virtually incomprehensible.
For instance ...
It seems that up to 3.3, the class matplotlib.colors.SymLogNorm had a nice description,
https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.colors.SymLogNorm.html
But it has since vanished.
https://matplotlib.org/stable/api/_as_gen/matplotlib.colors.SymLogNorm.html#matplotlib.colors.SymLogNorm
All this key description is missing ...
The symmetrical logarithmic scale is logarithmic in both the positive and negative directions from the origin.
Since the values close to zero tend toward infinity, there is a need to have a range around zero that is linear. The parameter linthresh allows the user to specify the size of this range (-linthresh, linthresh).linthresh: The range within which the plot is linear (to avoid having the plot go to infinity around zero).
linscale: This allows the linear range (-linthresh to linthresh) to be stretched relative to the logarithmic range. Its value is the number of decades to use for each half of the linear range. For example, when linscale == 1.0 (the default), the space used for the positive and negative halves of the linear range will be equal to one decade in the logarithmic range. Defaults to 1.
This occurs also for other classes, and not just in this module :
E.G. matplotlib.collections.RegularPolyCollection :
https://matplotlib.org/stable/api/collections_api.html?highlight=circumscribing#matplotlib.collections.RegularPolyCollection
( old version : https://matplotlib.org/3.1.1/api/collections_api.html#matplotlib.collections.RegularPolyCollection )
And this one is, I think, very important descriptive information that is no longer available
but certainly not all of them, e.g. LinearSegmentedColormap
https://matplotlib.org/stable/api/_as_gen/matplotlib.colors.LinearSegmentedColormap.html#matplotlib.colors.LinearSegmentedColormap
(which is fine)
In fact, this last one is interesting, because it shows that the class docstring and the __init__ docstring have been combined into a single paragraph.
This leads me to guess that, just maybe, nothing appears when the class has a class docstring but no __init__ docstring.
I have tried to understand at what point this went wrong,
but unfortunately it's all rather beyond my understanding of Sphinx and schemes.
Suggested Improvement
Need to re-instate the missing docstring descriptions into the API documentation build.
Matplotlib version
- Operating system: linux
- Matplotlib version : -
- Matplotlib documentation version (is listed under the logo): 3.4.2
Activity
jklymak commentedon Jul 6, 2021
@anntzer is this because of
_make_norm_from_scale?tacaswell commentedon Jul 6, 2021
still broken in: https://matplotlib.org/devdocs/api/_as_gen/matplotlib.colors.SymLogNorm.html#matplotlib.colors.SymLogNorm
This may be due to changes in CPython. Around 3.9 there was some changes to the way docstings got inherited / merged (see https://bugs.python.org/issue40257 for one entry point into that discussion), but @jklymak 's suggestion seems more likely.
QuLogic commentedon Jul 7, 2021
I'm not sure what you mean; there's nothing missing from this one?
anntzer commentedon Jul 7, 2021
For make_norm_from_scale it looks like this likely comes from python/cpython@08b47c3 not fully reverting python/cpython@fbf2786 (e.g. in pydoc.py), although I am not certain of the exact call chain. A simple repro is
In any case, a simple enough fix is likely to explicitly inherit the docstring with
Brownie points for anyone who makes a PR out of this.
QuLogic commentedon Jul 7, 2021
I'm just waiting for sphinx to finish to confirm that that will fix it.
pp-mo commentedon Jul 7, 2021
Sorry, I think I was wrong about that one.
It has lost a bit of explanatory test, but not for this reason I think.
pp-mo commentedon Jul 7, 2021
Checked it out : problem where I saw it is now fixed.
Thanks @tacaswell @QuLogic @anntzer @jklymak -- awesome speed of response !
🚀