"%matplotlib inline" giving a syntax error

0 votes

I have the following code snippet:

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

It throws a syntax error. What do I do?

Aug 1 in Python by Ajay
382 views
how to rectify this error?
@Merlin's suggestion did not work for you?

1 answer to this question.

0 votes

If you're using Jupyter notebook, just mention this line int he first cell. 

In []: %matplotlib inline

This is a really good command and works best with Jupiter IPython Notebook. Its basically used to show an image automatically within the browser without using show().

You can eliminate the use of this function complete and replace it with the bellow code:

import matplotlib.pyplot as plt
new_obj.resample('M').sum().plot(kind="bar")
plt.show()
answered Aug 1 by Merlin

Related Questions In Python

0 votes
1 answer

'Syntax Error: invalid syntax' for no apparent reason

You're missing a close paren in this ...READ MORE

answered Aug 13, 2018 in Python by Priyaj
• 56,900 points
114 views
0 votes
1 answer

How to print a message or the error if a file is not found?

To print the message that file is not ...READ MORE

answered Jan 2 in Python by Omkar
• 67,600 points
34 views
0 votes
0 answers

what is a name error in python?

why am i getting a name error ...READ MORE

Mar 7 in Python by anonymous
206 views
0 votes
1 answer

what is a type error in python?

you get a type error when you ...READ MORE

answered Mar 8 in Python by Waseem
• 4,480 points
56 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 283 views
+4 votes
6 answers
0 votes
1 answer

Why am I getting a error when I am printing two different data types in python?

different data type is being used. that ...READ MORE

answered Mar 6 in Python by Mohammad
• 3,060 points
41 views
+1 vote
2 answers