Search code examples
pythonmatplotlibpydevjupyter

Can %matplotlib notebook only be bused in Jupyter?


I have this and it works in jupyter in browser:

%matplotlib notebook

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import scipy as sp

However, after I copied it to a python file in the PyDev IDE editor, it always complains the first line:

 %matplotlib notebook

Error message:

Encountered "%" at line 1, column 1. Was expecting one of:     <EOF>      <NEWLINE> ...     "(" ...     "{" ... 

Does this mean the magic method can only be used in jupyter notebook?


Solution

  • Yes, It's a jupyter notebook command.