"%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
how to rectify this error?
@Merlin's suggestion did not work for you?

2 answers 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
answered Aug 1, 2019 by Merlin
0 votes
I found a good solution to solve the problem, in this web address https://zhuanlan.zhihu.com/p/34948525
answered May 2 by Edu

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
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,040 points
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
+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 929 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,230 points
+1 vote
3 answers