Whenever I try to plot using pylab, I get "matplotlib.lines.Line2D object at ..." I installed numpy and matplotlib, anything else I need to install? Thank you.
Gotta type 'pylab.show()', in MATLAB one just types 'plot' and it plots things without anything else.
The message that you have is the physical address of the object that is created when you type "plot". The command in python is "pylab.plot()" with the parentheses. Inside the parentheses, you need to specify *what* you want to plot. (This is why when you call it without the parentheses you get the pointer to the object.) Ex: pylab.plot([1,2,3],[1,2,3]) plots a line. Depending on your shell (eg. idle or ipython), you'll need to type pylab.show() as well, to actually have the figure popping out on your screen. Concerning Matlab: Python and Matlab are two different languages, hence have different sintaxes. You should not assume that, since a command does something in Matlab, it will do the same thing in Python - or do it in the same way :)
http://matplotlib.sourceforge.net/faq/usage_faq.html#coding-styles maybe you can be interested in this article: apparently, it is possible to choose to import packages in a way that keeps your plotting experience very close to Matlab-style.
Thank you fra
Join our real-time social learning platform and learn together with your friends!