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.

0

2 Answers 2

3

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

Sign up to request clarification or add additional context in comments.

3 Comments

Sure, but this is ipython, which has object?, much shorter and more helpful.
@MartijnPieters ok...you mean help wouldnt work in IPython...i'm not familiar with it, i confess
No, help() works, but ipython has better facilities available.
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.