SwimBikeRun SwimBikeRun - 1 year ago 85
Python Question

Where is the documentation source for python? (and spyder documentation features)

Where is the documentation kept for spyder (python IDE) to access?

As I am typing

in the spyder console, I get a pop up for the documentation for savefig(). It's a pretty nice feature, but it disappears as soon as I move the mouse. Where is it pulling this documentation from? I have searched the /doc folder and can't find anything related to matplotlib. I would like to open it in a PDF viewer on another monitor.

import matplotlib.pyplot as plt

Here is an image of the documentation for clarification:

Image of savefig doc

Answer Source

The documentation that you're seeing comes from the docstrings of the function you typed in. You can get the raw text with plt.savefig.__doc__, or get it with a bit of formatting by using the builtin help command from an interactive interpreter: help(plt.savefig). Spyder applies some additional fancy formatting to the contents of its documentation window.

How detailed the documentation is will vary quite a bit from module to module. In the case of matplotlib, it's quite detailed, probably because the maintainers have put the effort in to make it easy to use that package without a lot of programming experience.

As for your question about how you can view those docs outside of Spyder, I'd suggest looking online. I see on the matplotlib homepage they have extensive documentation, including web pages with the same contents as the docs you were seeing (presumably generated from the same docstrings).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download