"%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, 2019 in Python by Ajay
4,109 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, 2019 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
• 57,530 points
304 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, 2019 in Python by Omkar
• 69,000 points
81 views
0 votes
0 answers

what is a name error in python?

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

Mar 7, 2019 in Python by anonymous
383 views
0 votes
1 answer
+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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 777 views
0 votes
0 answers
+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, 2019 in Python by Mohammad
• 3,210 points
72 views
+1 vote
3 answers