Please I am getting error message when running this code in Python.

import numpy as np

import matplotlib.pyplot as plt

mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)

# the histogram of the data
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)

plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title('Histogram of IQ')
plt.text(60, .025, r'\\mu=100,\\ \\sigma=15')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
plt.show()
SyntaxError: multiple statements found while compiling a single statement

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Please-I-am-getting-error-message-when-running-this-code-in-Python-tp47047.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.

I suspect it is the extra backslash there in the plt.text() call.

···

On Tue, May 3, 2016 at 1:34 AM, vishal <vishal.goundar at gmail.com> wrote:

>>> import numpy as np
import matplotlib.pyplot as plt

mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)

# the histogram of the data
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)

plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title('Histogram of IQ')
plt.text(60, .025, r'\\mu=100,\\ \\sigma=15')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
plt.show()
SyntaxError: multiple statements found while compiling a single statement

--
View this message in context:
http://matplotlib.1069221.n5.nabble.com/Please-I-am-getting-error-message-when-running-this-code-in-Python-tp47047.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel at python.org
Matplotlib-devel Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20160516/764f56fb/attachment.html&gt;

It looks to me almost like the code's been pasted into a Python interpreter
session and it's not picking up the newlines.

Ryan

···

On Mon, May 16, 2016 at 12:29 PM, Benjamin Root <ben.v.root at gmail.com> wrote:

I suspect it is the extra backslash there in the plt.text() call.

On Tue, May 3, 2016 at 1:34 AM, vishal <vishal.goundar at gmail.com> wrote:

>>> import numpy as np
import matplotlib.pyplot as plt

mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)

# the histogram of the data
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)

plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title('Histogram of IQ')
plt.text(60, .025, r'\\mu=100,\\ \\sigma=15')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
plt.show()
SyntaxError: multiple statements found while compiling a single statement

--
View this message in context:
http://matplotlib.1069221.n5.nabble.com/Please-I-am-getting-error-message-when-running-this-code-in-Python-tp47047.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel at python.org
Matplotlib-devel Info Page

_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel at python.org
Matplotlib-devel Info Page

--
Ryan May
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20160516/7555b954/attachment.html&gt;

heh, yeah, I didn't notice that. The SyntaxError would be raised by the
interpretor, not tex parser.

Solution, use IPython, not IDLE.

···

On Mon, May 16, 2016 at 2:42 PM, Ryan May <rmay31 at gmail.com> wrote:

It looks to me almost like the code's been pasted into a Python
interpreter session and it's not picking up the newlines.

Ryan

On Mon, May 16, 2016 at 12:29 PM, Benjamin Root <ben.v.root at gmail.com> > wrote:

I suspect it is the extra backslash there in the plt.text() call.

On Tue, May 3, 2016 at 1:34 AM, vishal <vishal.goundar at gmail.com> wrote:

>>> import numpy as np
import matplotlib.pyplot as plt

mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)

# the histogram of the data
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)

plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title('Histogram of IQ')
plt.text(60, .025, r'\\mu=100,\\ \\sigma=15')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
plt.show()
SyntaxError: multiple statements found while compiling a single statement

--
View this message in context:
http://matplotlib.1069221.n5.nabble.com/Please-I-am-getting-error-message-when-running-this-code-in-Python-tp47047.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel at python.org
Matplotlib-devel Info Page

_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel at python.org
Matplotlib-devel Info Page

--
Ryan May

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20160516/b3b5d45a/attachment-0001.html&gt;