Antoni Parellada
Antoni Parellada

Reputation: 4791

plot() in python error message: No module named 'plotting'

I am trying to take an interesting course offered by Coursera on linear algebra. The course is in Python. I'm familiar with R instead.

It seems like to follow the course I can't assume that plotting is going to be as easy as calling plot().

In particular, there is this command in one of the first lectures:

>>>L = [2 + 2j, 3 + 2j, 1.75 + 1j]
>>>from plotting import plot
>>> plot(L)

which works fine for the instructor, but results in the following error when I try:

>>> from plotting import plot
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    from plotting import plot
ImportError: No module named 'plotting'

I went to the help pages, and it mentions that plotting in Python uses the internet browser, and advising to check which browser is the default. I use Opera (don't ask...), and it seems as though it is one of the recognized browsers.

If it is just a matter of installing the 'plotting' module as the error message clearly spells out, can I ask how this is done?

NOTE: I have circumvented this issue by simply downloading anaconda and then, from the cmd prompt calling IP Notebook typing: > ipython notebook at the prompt. A browsers should open with the jupyter interface; ipython notebook is phenomenal, allowing scientific plotting, markdown and latex in a local webserver interface that is clean and nice. During the session the cmd windows should remain open. Also, to save projects to a folder, the directory should be changed to that folder before starting the session, also using the cmd line. This is what it looks like:

enter image description here

Upvotes: 2

Views: 12965

Answers (5)

Yassine
Yassine

Reputation: 1

I take also a course by Coursera on Statistics and I had the same problem but I solved the problem by using this code:

import matplotlib.pyplot as plt

data = [3,4,2,4,3,5,3,6,4,3]
plt.hist(data);

Upvotes: 0

user2159471
user2159471

Reputation: 333

The plotting.py is having a procedure to remove the file at exit. I added a dummy print command after call to plot() to delay the method from firing and was able to see the plot in debugging session. The remove at exit procedure can be removed only that it would be creating Temporary files on machine each time plot() is run.

from plotting import plot plot([1+2j]) print('Wait')

Upvotes: 0

BJC
BJC

Reputation: 501

Download the plotting.py from http://resources.codingthematrix.com/ to resolve this.

Upvotes: 3

Achayan
Achayan

Reputation: 5885

I think you need to install sympy http://docs.sympy.org/dev/modules/plotting.html check the documentation and installing deatils https://github.com/sympy/sympy/wiki/Download-Installation

Upvotes: 1

BucketLava
BucketLava

Reputation: 15

I don't know there's a library called plot. But you can find something similar here:Wiki-NumericAndScientific-Plotting

Upvotes: 0

Related Questions