10 Reasons Python Rocks for Research (And a Few Reasons it Doesn’t)

Including plots is easy. The following doc-string code:

.. plot:: import numpy as np import matplotlib.pyplot as plt x = np.linspace(0,2, 1000) plt.figure() plt.plot(x, np.sqrt(x), label = r"Skiing: $\sqrt{x}$") plt.plot(x, x**2, label = r"Snowboarding: $x^2$") plt.title("Learning Curves for Snowboarding and Skiing") plt.xlabel("Time") ; plt.ylabel("Skill") plt.legend(loc='upper left') plt.show()

gives

In essence, this enables not only comments about the code, but also comments about the science and research behind your code, to be interwoven into the coding file.

Nice, I didn’t know that you could integrate matplotlib with Sphinx.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s