when i use matplotlib in jupyter notebook,it always raise “ matplotlib is currently using a non-GUI backend” error?

后端 未结 10 1454
耶瑟儿~
耶瑟儿~ 2020-11-28 07:40
import matplotlib.pyplot as pl
%matplot inline
def learning_curves(X_train, y_train, X_test, y_test):
\"\"\" Calculates the performance of several models with varyin         


        
10条回答
  •  醉梦人生
    2020-11-28 08:21

    adding %matplotlib inline while importing helps for smooth plots in notebook

    %matplotlib inline
    import matplotlib.pyplot as plt
    

    %matplotlib inline sets the backend of matplotlib to the 'inline' backend: With this backend, the output of plotting commands is displayed inline within frontends like the Jupyter notebook, directly below the code cell that produced it. The resulting plots will then also be stored in the notebook document.

提交回复
热议问题