You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Set return of type Axes in Numpydoc docstring return type hint for Figure.add_subplot and Figure.add_axes to help jedi introspection #7535
I've noticed there is push in the documentation for using objects over the pyplot functions. I agree that this the best way to use Matplotlib(other than the set_ get_ methods). The problem I have is that Jedi(used in Spyder IDE and other editors) doesn't recognize the return types of some Matplotlib functions and methods such as plt.figure and plt.subplot. For example in Jedi 0.9 you get:
In [1]: import jedi; jedi.Script('import pylab; a = pylab.figure(); a.set_f').completions()
Out[1]: []
I usually have to play with MPL code in the console first to remember all the functions instead of just typing it all in the editor.
Luckily recently this patch(davidhalter/jedi#796) has been recently submitted to Jedi(not by me) which adds among other things implements return type hints from numpydoc docstrings. With this Jedi patch I get:
To help us understand and resolve your issue please check that you have provided
the information below.
Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
I'm using Python 3.5 on Linux with Matplotlib 1.5.3
How did you install Matplotlib and Python (pip, anaconda, from source ...)
Anaconda
If possible please supply a Short, Self Contained, Correct, Example
that demonstrates the issue i.e a small piece of code which reproduces the issue
and can be run with out any other (or as few as possible) external dependencies.
If this is an image generation bug attach a screenshot demonstrating the issue.
If this is a regression (Used to work in an earlier version of Matplotlib), please
note where it used to work.
changed the title [-]Set return of type Axes in Numpydoc fuction returns for Figure.add_subplot and Figure.add_axes to help jedi introspection[/-][+]Set return of type Axes in Numpydoc docstring return type hint for Figure.add_subplot and Figure.add_axes to help jedi introspection[/+]on Nov 30, 2016
This is basically just another reason to complete #7205, so I'm going to close this one as sort-of-duplicate. I added the two methods to the list there (though eventually everything should be done.)
Activity
[-]Set return of type Axes in Numpydoc fuction returns for Figure.add_subplot and Figure.add_axes to help jedi introspection[/-][+]Set return of type Axes in Numpydoc docstring return type hint for Figure.add_subplot and Figure.add_axes to help jedi introspection[/+]QuLogic commentedon Nov 30, 2016
This is basically just another reason to complete #7205, so I'm going to close this one as sort-of-duplicate. I added the two methods to the list there (though eventually everything should be done.)