Trying to get matplotlib/numpy to work. Have tried different solutions and out of ideas

62 views Asked by At

I'm trying to run a basic matplotlib script to ensure that everything is working. The program is as follows:

import numpy as np
import matplotlib.pyplot as plt

x=np.arrange(0,5,0.1);
y=np.sin(x)
plt.plot(x,y)

But when I run "python a.py" in the terminal I am getting the error that the numpy module has no attribute 'arrange'.

I uninstalled numpy and matplotlib and reinstalled them. First numpy, then matplotlib through the ubuntu repository but I am still getting this error. I can't figure out what is wrong. Am I getting an incomplete installation or something? I am using Ubuntu 14.04.

1

There are 1 answers

0
hajtos On

The method name is arange, not arrange.

Also, after using plt.plot(...), you need to call plt.show() to draw the plot.