I can write  some fairly decent Python code. In fact, I've  recently written 400-500 lines often using numpy. There are still a number of concepts that are fuzzy. I have a modest familiarity of OOP from years ago with C++, and a few things I've picked up from Python. Five years ago, I was working with Matlab, but my knowledge  has diminished.

Nevertheless, I finally decided to graphics, MPL, to display what I'm doing. I've  had some modest success using very basic operations, sometime guessing at usage along the way. I've looked through the bewildering array of MPL, pylab,  pyplot docs and examples.  It's  slowly fitting together. I decided to give the following web page a closer look to see what are the differences between the MPL players. <http://matplotlib.sourceforge.net/faq/usage_faq.html>. I've copied a few paragraphs at the start of the FAQ below.

I've studied it fairly carefully, and more or less comprehend it. However, why does it need words like state-machine, convenience functions, and object-oriented. I'm familiar with them all, but the concepts really aren't presented clearly in relationship to the code below. I'm not even sure if we are  pro-pylab or  pyplot as the preferred-style. What part of some of the code is pyplot or otherwise? Highlight it. Not everyone is clear on some of the assumed Python concepts here.

It seems as though Python has a way of aligning itself with other tools, For example, Matlab and Tk. Despite the apparent appeal of MPL and Tkinter, seldom, maybe  never, is anyone who is attracted to these ideas really familiar with the tools on which they are based. (Perhaps its the other way. Everyone knows them )Yet  no explanation is offered.  What would that take, 3 pages each?

============================================

Matplotlib, pylab, and pyplot: how are they related?

Matplotlib is the whole package; pylab is a module in matplotlib that gets installed alongside matplotlib; and matplotlib.pyplot is a module in matplotlib.

Pyplot provides a Matlab-style state-machine interface to the underlying object-oriented plotting library in matplotlib.

Pylab combines the pyplot functionality (for plotting) with the numpy functionality (for mathematics and for working with arrays) in a single namespace, making that namespace (or environment) even more Matlab-like. This is what you get if you use the ipython shell with the -pylab option, which imports everything from pylab and makes plotting fully interactive.

...

And using pyplot convenience functions, but object-orientation for the rest:

import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0, 10, 0.2)
y = np.sin(x)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x, y)
plt.show()
So, why do all the extra typing required as one moves away from...
=========================



--
My life in two words. "Interrupted Projects." -- WTW (quote originator)



------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to