%matplotlib notebook
import matplotlib.pyplot as plt
import time
from IPython import display
import numpy as np
import pandas as pd
from pandas import DataFrame, Series
from numpy.random import randn
fig,ax = plt.subplots(1,1)
people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')
ax.set_xlabel("Load", fontsize=12)
ax.set_ylabel("People", fontsize=12)
y_pos = np.arange(len(people))
ax.set_yticks(y_pos)
ax.set_yticklabels(people, rotation=75)
fig.canvas.draw()
width = 0.4
for i in range(0,3):
p1 = 3 + 10 * np.random.rand(len(people))
p2 = 3 + 10 * np.random.rand(len(people))
df = DataFrame({'p1': p1, 'p2': p2})
ax.barh(y_pos, df['p1'], width, color='red')
ax.barh(y_pos + width, df['p2'], width, color='blue')
fig.canvas.draw()
time.sleep(0.5)
为什么命令在我的本地机器上不起作用?