Solve the problem that “figure size 640×480 with 1 axes” does not display pictures in jupyter notebook

Problem code: (negligible code)

import numpy as np
from sklearn.feature_selection import SelectKBest, f_classif
import matplotlib.pyplot as plt
predictors = ["Pclass", "Sex", "Age", "SibSp", "Parch", "Fare", "Embarked", "FamilySize", "Title", "NameLength"]

# Perform feature selection
selector = SelectKBest(f_classif, k=5)[predictors], titanic["Survived"])

# Get the raw p-values for each feature, and transform from p-values into scores
scores = -np.log10(selector.pvalues_)

# Plot the scores.  See how "Pclass", "Sex", "Title", and "Fare" are the best?, scores)
plt.xticks(range(len(predictors)), predictors, rotation='vertical')

# Pick only the four best features.
predictors = ["Pclass", "Sex", "Fare", "Title"]

alg = RandomForestClassifier(random_state=1, n_estimators=50, min_samples_split=8, min_samples_leaf=4)

Running results:
& lt; figure size 640x480 with 1 axes & gt;
no pictures are displayed

Add % Matplotlib inline to the code header

import pandas #ipython notebook
titanic = pandas.read_csv("titanic_train.csv")
#print (titanic.describe())
%matplotlib inline

Read More: