0

I'm using the jupyter ipython notebook by anaconda.

IS there a quick way of looking at the arguments of a function like we do in RStudio? For e.g. ?merge displays documentation for merge in the lower right window of RStudio.

I was specifically looking for arguments of matplotlib.figure() which I found here but this is time consuming: http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.figure

Found this post related to the question: Getting list of parameter names inside python function

but not sure if it is the same question.

Community
  • 1
  • 1
vagabond
  • 3,526
  • 5
  • 43
  • 76

2 Answers2

3

You can try help(matplotlib.figure) after importing matplotlib

SoreDakeNoKoto
  • 1,175
  • 1
  • 9
  • 16
1

Type matplotlib.figure? at the command prompt, and it'll give you the signature and documentation:

In [1]: import matplotlib

In [2]: matplotlib.figure?
Type:        module
String form: <module 'matplotlib.figure' from '~/venv/lib/python2.7/site-packages/matplotlib/figure.pyc'>
File:        ~/venv/lib/python2.7/site-packages/matplotlib/figure.py
Docstring:
The figure module provides the top-level
:class:`~matplotlib.artist.Artist`, the :class:`Figure`, which
contains all the plot elements.  The following classes are defined

:class:`SubplotParams`
    control the default spacing of the subplots

:class:`Figure`
    top level container for all plot elements

From the IPython introduction:

Exploring your objects

Typing object_name? will print all sorts of details about any object, including docstrings, function definition lines (for call arguments) and constructor details for classes. To get specific information on an object, you can use the magic commands %pdoc, %pdef, %psource and %pfile

You can also use the standard Python help() function; the output is a little more verbose and not coloured, like the ipython object? command however.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343