鍍金池/ 問答/數(shù)據(jù)分析&挖掘  Java  Python/ pycharm中,matplotlib.pyplot.show()顯示的圖表,輸

pycharm中,matplotlib.pyplot.show()顯示的圖表,輸出到sciview,怎么彈出來?

1.問題:

和題目一樣,pycharm中,matplotlib.pyplot.show()顯示的圖表,輸出到sciview,怎么彈出來?

2.代碼:

import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style


style.use('fivethirtyeight')

fig = plt.figure(figsize=(9, 6))
ax1 = fig.add_subplot(1, 1, 1)


def animate(i):
    graph_data = open('result.txt', 'r').read()
    lines = graph_data.split('\n')
    xs = []
    ys = []
    for line in lines:
        if len(line) > 1:
            x, y = line.split(' ')
            xs.append(int(x))
            ys.append(int(y))
    ax1.clear()
    ax1.plot(xs, ys)


ani = animation.FuncAnimation(fig, animate, interval=1000)
plt.show()

result.txt里面是數(shù)據(jù),兩列,中間空格,格式:
0 9057
1 9239
2 9262
3 9339
······

3.運(yùn)行結(jié)果:

本人是筆記本,pycharm版本2017.3.1,python版本3.6.4:
我的運(yùn)行結(jié)果

在其他電腦上試了下,代碼一樣,臺式機(jī),pycharm版本2017.2.4,python版本3.6.2,結(jié)果是下面:
別的電腦運(yùn)行結(jié)果
這個效果正是我想要的,可是我的電腦運(yùn)行不出來,什么問題?

4.自己思考:

我的是直接把結(jié)果輸出到了SciView窗口中,在View-Tool Windows中,能看到這個選項,但是我測試的臺式機(jī)的pycharm上面,View-Tool Windows沒有這個選項,那么,就應(yīng)該是pycharm版本的問題。
在cmd中執(zhí)行,是正常的,但是在pycharm中不行,沒有找到怎么辦,百度SciView,結(jié)果很少。
求助。

回答
編輯回答
空痕

嗯,自己找到答案了。
SciView in PyCharm 2017.3 reduces functionality of Matplotlib
具體辦法:Settings | Tools | Python Scientific | Show Plots in Toolwindow,去掉

2018年5月1日 07:34